{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "----------\n",
    "2022春 《交互式数据可视化》/《Interactive Data Visualization》 week09\n",
    "\n",
    "主讲 许智超\n",
    "\n",
    "时间：2022.04.24\n",
    "\n",
    "-----"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 本周内容-堆叠柱状图\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"1002\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  const force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  const JS_MIME_TYPE = 'application/javascript';\n",
       "  const HTML_MIME_TYPE = 'text/html';\n",
       "  const EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  const CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    const script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    const cell = handle.cell;\n",
       "\n",
       "    const id = cell.output_area._bokeh_element_id;\n",
       "    const server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      const cmd_clean = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd_clean, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            const id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      const cmd_destroy = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd_destroy);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    const output_area = handle.output_area;\n",
       "    const output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!Object.prototype.hasOwnProperty.call(output.data, EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    const toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      const bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      const script_attrs = bk_div.children[0].attributes;\n",
       "      for (let i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "        toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      const toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      const props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    const events = require('base/js/events');\n",
       "    const OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  const NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    const el = document.getElementById(\"1002\");\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error(url) {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (let i = 0; i < css_urls.length; i++) {\n",
       "      const url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error.bind(null, url);\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    for (let i = 0; i < js_urls.length; i++) {\n",
       "      const url = js_urls[i];\n",
       "      const element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error.bind(null, url);\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  \n",
       "  const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.2.min.js\"];\n",
       "  const css_urls = [];\n",
       "  \n",
       "\n",
       "  const inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "    \n",
       "    \n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if (root.Bokeh !== undefined || force === true) {\n",
       "      \n",
       "    for (let i = 0; i < inline_js.length; i++) {\n",
       "      inline_js[i].call(root, root.Bokeh);\n",
       "    }\n",
       "    if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      const cell = $(document.getElementById(\"1002\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  const force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  const NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    const el = document.getElementById(\"1002\");\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error(url) {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (let i = 0; i < css_urls.length; i++) {\n      const url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error.bind(null, url);\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    for (let i = 0; i < js_urls.length; i++) {\n      const url = js_urls[i];\n      const element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error.bind(null, url);\n      element.async = false;\n      element.src = url;\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  \n  const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.2.min.js\"];\n  const css_urls = [];\n  \n\n  const inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    function(Bokeh) {\n    \n    \n    }\n  ];\n\n  function run_inline_js() {\n    \n    if (root.Bokeh !== undefined || force === true) {\n      \n    for (let i = 0; i < inline_js.length; i++) {\n      inline_js[i].call(root, root.Bokeh);\n    }\n    if (force === true) {\n        display_loaded();\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      const cell = $(document.getElementById(\"1002\")).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import output_notebook,figure,show\n",
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.models import ColumnDataSource"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 堆叠柱状图（纵向）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### DEMO"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"be61d41c-e69b-4b4e-b38d-6a60a6c059f5\" data-root-id=\"7372\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"79ff3a45-e027-4697-95ce-02e5b781df49\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"7383\"}],\"center\":[{\"id\":\"7385\"},{\"id\":\"7389\"},{\"id\":\"7428\"}],\"height\":300,\"left\":[{\"id\":\"7386\"}],\"outline_line_color\":null,\"renderers\":[{\"id\":\"7416\"},{\"id\":\"7434\"},{\"id\":\"7451\"}],\"title\":{\"id\":\"7373\"},\"toolbar\":{\"id\":\"7398\"},\"x_range\":{\"id\":\"7375\"},\"x_scale\":{\"id\":\"7379\"},\"y_range\":{\"id\":\"7377\"},\"y_scale\":{\"id\":\"7381\"}},\"id\":\"7372\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"7426\",\"type\":\"Selection\"},{\"attributes\":{\"end\":16,\"start\":0},\"id\":\"7377\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"7420\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fields\":[\"2015\",\"2016\",\"2017\"]},\"id\":\"7411\",\"type\":\"Stack\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"7408\"}},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#718dbf\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#718dbf\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#718dbf\"},\"top\":{\"expr\":{\"id\":\"7409\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"fruits\"}},\"id\":\"7432\",\"type\":\"VBar\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"7410\"}},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#e84d60\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#e84d60\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#e84d60\"},\"top\":{\"expr\":{\"id\":\"7411\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"fruits\"}},\"id\":\"7450\",\"type\":\"VBar\"},{\"attributes\":{\"fields\":[\"2015\",\"2016\"]},\"id\":\"7409\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"7379\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"7371\"},\"glyph\":{\"id\":\"7448\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"7450\"},\"name\":\"2017\",\"nonselection_glyph\":{\"id\":\"7449\"},\"view\":{\"id\":\"7452\"}},\"id\":\"7451\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"7406\"}},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#c9d9d3\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#c9d9d3\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#c9d9d3\"},\"top\":{\"expr\":{\"id\":\"7407\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"fruits\"}},\"id\":\"7415\",\"type\":\"VBar\"},{\"attributes\":{\"fields\":[\"2015\",\"2016\"]},\"id\":\"7410\",\"type\":\"Stack\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"7410\"}},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#e84d60\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#e84d60\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#e84d60\"},\"top\":{\"expr\":{\"id\":\"7411\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"fruits\"}},\"id\":\"7449\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"7425\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"7371\"},\"glyph\":{\"id\":\"7431\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"7433\"},\"name\":\"2016\",\"nonselection_glyph\":{\"id\":\"7432\"},\"view\":{\"id\":\"7435\"}},\"id\":\"7434\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"tools\":[{\"id\":\"7390\"},{\"id\":\"7391\"},{\"id\":\"7392\"},{\"id\":\"7393\"},{\"id\":\"7394\"},{\"id\":\"7395\"},{\"id\":\"7397\"}]},\"id\":\"7398\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"7421\",\"type\":\"AllLabels\"},{\"attributes\":{\"factors\":[\"Apples\",\"Pears\",\"Nectarines\",\"Plums\",\"Grapes\",\"Strawberries\"],\"range_padding\":0.1},\"id\":\"7375\",\"type\":\"FactorRange\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"7420\"},\"group\":null,\"major_label_policy\":{\"id\":\"7421\"},\"minor_tick_line_color\":null,\"ticker\":{\"id\":\"7387\"}},\"id\":\"7386\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"7371\"}},\"id\":\"7417\",\"type\":\"CDSView\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"7423\"},\"group\":null,\"major_label_policy\":{\"id\":\"7424\"},\"minor_tick_line_color\":null,\"ticker\":{\"id\":\"7384\"}},\"id\":\"7383\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"source\":{\"id\":\"7371\"}},\"id\":\"7435\",\"type\":\"CDSView\"},{\"attributes\":{\"overlay\":{\"id\":\"7396\"}},\"id\":\"7392\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"fields\":[\"2015\"]},\"id\":\"7408\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"7371\"},\"glyph\":{\"id\":\"7413\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"7415\"},\"name\":\"2015\",\"nonselection_glyph\":{\"id\":\"7414\"},\"view\":{\"id\":\"7417\"}},\"id\":\"7416\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"7390\",\"type\":\"PanTool\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"7408\"}},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#718dbf\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#718dbf\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#718dbf\"},\"top\":{\"expr\":{\"id\":\"7409\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"fruits\"}},\"id\":\"7433\",\"type\":\"VBar\"},{\"attributes\":{\"label\":{\"value\":\"2017\"},\"renderers\":[{\"id\":\"7451\"}]},\"id\":\"7463\",\"type\":\"LegendItem\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"7396\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"axis\":{\"id\":\"7383\"},\"coordinates\":null,\"grid_line_color\":null,\"group\":null,\"ticker\":null},\"id\":\"7385\",\"type\":\"Grid\"},{\"attributes\":{\"data\":{\"2015\":[2,1,4,3,2,4],\"2016\":[5,3,4,2,4,6],\"2017\":[3,2,4,4,5,3],\"fruits\":[\"Apples\",\"Pears\",\"Nectarines\",\"Plums\",\"Grapes\",\"Strawberries\"]},\"selected\":{\"id\":\"7426\"},\"selection_policy\":{\"id\":\"7425\"}},\"id\":\"7371\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"7395\",\"type\":\"HelpTool\"},{\"attributes\":{\"fields\":[]},\"id\":\"7406\",\"type\":\"Stack\"},{\"attributes\":{\"fields\":[\"2015\"]},\"id\":\"7407\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"7394\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"7424\",\"type\":\"AllLabels\"},{\"attributes\":{\"label\":{\"value\":\"2015\"},\"renderers\":[{\"id\":\"7416\"}]},\"id\":\"7429\",\"type\":\"LegendItem\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"Fruit Counts by Year\"},\"id\":\"7373\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"7381\",\"type\":\"LinearScale\"},{\"attributes\":{\"source\":{\"id\":\"7371\"}},\"id\":\"7452\",\"type\":\"CDSView\"},{\"attributes\":{\"axis\":{\"id\":\"7386\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"7389\",\"type\":\"Grid\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"7410\"}},\"fill_color\":{\"value\":\"#e84d60\"},\"hatch_color\":{\"value\":\"#e84d60\"},\"line_color\":{\"value\":\"#e84d60\"},\"top\":{\"expr\":{\"id\":\"7411\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"fruits\"}},\"id\":\"7448\",\"type\":\"VBar\"},{\"attributes\":{\"callback\":null,\"tooltips\":\"$name @fruits: @$name\"},\"id\":\"7397\",\"type\":\"HoverTool\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"7406\"}},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#c9d9d3\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#c9d9d3\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#c9d9d3\"},\"top\":{\"expr\":{\"id\":\"7407\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"fruits\"}},\"id\":\"7414\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"7387\",\"type\":\"BasicTicker\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"7408\"}},\"fill_color\":{\"value\":\"#718dbf\"},\"hatch_color\":{\"value\":\"#718dbf\"},\"line_color\":{\"value\":\"#718dbf\"},\"top\":{\"expr\":{\"id\":\"7409\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"fruits\"}},\"id\":\"7431\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"7391\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"7384\",\"type\":\"CategoricalTicker\"},{\"attributes\":{},\"id\":\"7423\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"label\":{\"value\":\"2016\"},\"renderers\":[{\"id\":\"7434\"}]},\"id\":\"7446\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"7393\",\"type\":\"SaveTool\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"7429\"},{\"id\":\"7446\"},{\"id\":\"7463\"}],\"location\":\"top_left\",\"orientation\":\"horizontal\"},\"id\":\"7428\",\"type\":\"Legend\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"7406\"}},\"fill_color\":{\"value\":\"#c9d9d3\"},\"hatch_color\":{\"value\":\"#c9d9d3\"},\"line_color\":{\"value\":\"#c9d9d3\"},\"top\":{\"expr\":{\"id\":\"7407\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"fruits\"}},\"id\":\"7413\",\"type\":\"VBar\"}],\"root_ids\":[\"7372\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"79ff3a45-e027-4697-95ce-02e5b781df49\",\"root_ids\":[\"7372\"],\"roots\":{\"7372\":\"be61d41c-e69b-4b4e-b38d-6a60a6c059f5\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "7372"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.core.properties import value\n",
    "# 数据\n",
    "fruits = ['Apples', 'Pears', 'Nectarines', 'Plums', 'Grapes', 'Strawberries']\n",
    "years = [\"2015\", \"2016\", \"2017\"]\n",
    "colors = [\"#c9d9d3\", \"#718dbf\", \"#e84d60\"]\n",
    "data = {'fruits' : fruits,\n",
    "        '2015'   : [2, 1, 4, 3, 2, 4],\n",
    "        '2016'   : [5, 3, 4, 2, 4, 6],\n",
    "        '2017'   : [3, 2, 4, 4, 5, 3]}\n",
    "\n",
    "source = ColumnDataSource(\n",
    "    data=data\n",
    ")\n",
    "# p.hbar_stack(years, y='fruits',height=0.8, color=colors, source=source,\n",
    "#             legend=[value(x) for x in years] )  # 堆叠柱状图，逐年堆叠\n",
    "\n",
    "# 画布\n",
    "p = figure(x_range=fruits, plot_height=300, title=\"Fruit Counts by Year\",\n",
    "#            toolbar_location=None,\n",
    "#            tools=\"hover\",\n",
    "           tooltips=\"$name @fruits: @$name\")\n",
    "# 绘图,直接堆叠各年数据\n",
    "p.vbar_stack(years, x='fruits', width=0.9, color=colors, source=source,\n",
    "             legend=[value(x) for x in years]) # legend=[{'value': '2015'}, {'value': '2016'}, {'value': '2017'}]\n",
    "# 其他\n",
    "p.y_range.start = 0\n",
    "p.y_range.end = 16\n",
    "p.x_range.range_padding = 0.1\n",
    "p.xgrid.grid_line_color = None\n",
    "p.axis.minor_tick_line_color = None\n",
    "p.outline_line_color = None\n",
    "p.legend.location = \"top_left\"\n",
    "p.legend.orientation = \"horizontal\"\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>指标</th>\n",
       "      <th>2022年第一季度</th>\n",
       "      <th>2021年第四季度</th>\n",
       "      <th>2021年第三季度</th>\n",
       "      <th>2021年第二季度</th>\n",
       "      <th>2021年第一季度</th>\n",
       "      <th>地区</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>13360</td>\n",
       "      <td>44993</td>\n",
       "      <td>35694</td>\n",
       "      <td>23604</td>\n",
       "      <td>12636</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>16230</td>\n",
       "      <td>54854</td>\n",
       "      <td>43592</td>\n",
       "      <td>28897</td>\n",
       "      <td>15472</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>6639</td>\n",
       "      <td>22306</td>\n",
       "      <td>17619</td>\n",
       "      <td>11490</td>\n",
       "      <td>6225</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>20630</td>\n",
       "      <td>75002</td>\n",
       "      <td>56498</td>\n",
       "      <td>38138</td>\n",
       "      <td>19585</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>22274</td>\n",
       "      <td>81518</td>\n",
       "      <td>61243</td>\n",
       "      <td>41381</td>\n",
       "      <td>21189</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>10016</td>\n",
       "      <td>33303</td>\n",
       "      <td>26125</td>\n",
       "      <td>17383</td>\n",
       "      <td>9326</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>22663</td>\n",
       "      <td>78027</td>\n",
       "      <td>58907</td>\n",
       "      <td>40357</td>\n",
       "      <td>21548</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>23772</td>\n",
       "      <td>82429</td>\n",
       "      <td>61915</td>\n",
       "      <td>42348</td>\n",
       "      <td>22636</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>12891</td>\n",
       "      <td>38521</td>\n",
       "      <td>31985</td>\n",
       "      <td>22535</td>\n",
       "      <td>12006</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>19366</td>\n",
       "      <td>57541</td>\n",
       "      <td>44712</td>\n",
       "      <td>30998</td>\n",
       "      <td>18263</td>\n",
       "      <td>浙江省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>22784</td>\n",
       "      <td>68487</td>\n",
       "      <td>52758</td>\n",
       "      <td>36294</td>\n",
       "      <td>21600</td>\n",
       "      <td>浙江省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>12541</td>\n",
       "      <td>35247</td>\n",
       "      <td>28474</td>\n",
       "      <td>20357</td>\n",
       "      <td>11686</td>\n",
       "      <td>浙江省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>16490</td>\n",
       "      <td>47498</td>\n",
       "      <td>36227</td>\n",
       "      <td>25119</td>\n",
       "      <td>15500</td>\n",
       "      <td>江苏省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>19251</td>\n",
       "      <td>57743</td>\n",
       "      <td>44267</td>\n",
       "      <td>30491</td>\n",
       "      <td>18194</td>\n",
       "      <td>江苏省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>10952</td>\n",
       "      <td>26791</td>\n",
       "      <td>20267</td>\n",
       "      <td>14455</td>\n",
       "      <td>10215</td>\n",
       "      <td>江苏省</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   指标  2022年第一季度  2021年第四季度  2021年第三季度  2021年第二季度  2021年第一季度  \\\n",
       "0     居民人均可支配收入累计值(元)      13360      44993      35694      23604      12636   \n",
       "1   城镇居民人均可支配收入累计值(元)      16230      54854      43592      28897      15472   \n",
       "2   农村居民人均可支配收入累计值(元)       6639      22306      17619      11490       6225   \n",
       "3     居民人均可支配收入累计值(元)      20630      75002      56498      38138      19585   \n",
       "4   城镇居民人均可支配收入累计值(元)      22274      81518      61243      41381      21189   \n",
       "5   农村居民人均可支配收入累计值(元)      10016      33303      26125      17383       9326   \n",
       "6     居民人均可支配收入累计值(元)      22663      78027      58907      40357      21548   \n",
       "7   城镇居民人均可支配收入累计值(元)      23772      82429      61915      42348      22636   \n",
       "8   农村居民人均可支配收入累计值(元)      12891      38521      31985      22535      12006   \n",
       "9     居民人均可支配收入累计值(元)      19366      57541      44712      30998      18263   \n",
       "10  城镇居民人均可支配收入累计值(元)      22784      68487      52758      36294      21600   \n",
       "11  农村居民人均可支配收入累计值(元)      12541      35247      28474      20357      11686   \n",
       "12    居民人均可支配收入累计值(元)      16490      47498      36227      25119      15500   \n",
       "13  城镇居民人均可支配收入累计值(元)      19251      57743      44267      30491      18194   \n",
       "14  农村居民人均可支配收入累计值(元)      10952      26791      20267      14455      10215   \n",
       "\n",
       "     地区  \n",
       "0   广东省  \n",
       "1   广东省  \n",
       "2   广东省  \n",
       "3    北京  \n",
       "4    北京  \n",
       "5    北京  \n",
       "6   上海市  \n",
       "7   上海市  \n",
       "8   上海市  \n",
       "9   浙江省  \n",
       "10  浙江省  \n",
       "11  浙江省  \n",
       "12  江苏省  \n",
       "13  江苏省  \n",
       "14  江苏省  "
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_居民人均可支配收入 = pd.read_csv('居民人均可支配收入.csv',encoding='utf-8')\n",
    "df_居民人均可支配收入"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>指标</th>\n",
       "      <th>2022年第一季度</th>\n",
       "      <th>2021年第四季度</th>\n",
       "      <th>2021年第三季度</th>\n",
       "      <th>2021年第二季度</th>\n",
       "      <th>2021年第一季度</th>\n",
       "      <th>地区</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>13360</td>\n",
       "      <td>44993</td>\n",
       "      <td>35694</td>\n",
       "      <td>23604</td>\n",
       "      <td>12636</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>20630</td>\n",
       "      <td>75002</td>\n",
       "      <td>56498</td>\n",
       "      <td>38138</td>\n",
       "      <td>19585</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>22663</td>\n",
       "      <td>78027</td>\n",
       "      <td>58907</td>\n",
       "      <td>40357</td>\n",
       "      <td>21548</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>19366</td>\n",
       "      <td>57541</td>\n",
       "      <td>44712</td>\n",
       "      <td>30998</td>\n",
       "      <td>18263</td>\n",
       "      <td>浙江省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>16490</td>\n",
       "      <td>47498</td>\n",
       "      <td>36227</td>\n",
       "      <td>25119</td>\n",
       "      <td>15500</td>\n",
       "      <td>江苏省</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 指标  2022年第一季度  2021年第四季度  2021年第三季度  2021年第二季度  2021年第一季度  \\\n",
       "0   居民人均可支配收入累计值(元)      13360      44993      35694      23604      12636   \n",
       "3   居民人均可支配收入累计值(元)      20630      75002      56498      38138      19585   \n",
       "6   居民人均可支配收入累计值(元)      22663      78027      58907      40357      21548   \n",
       "9   居民人均可支配收入累计值(元)      19366      57541      44712      30998      18263   \n",
       "12  居民人均可支配收入累计值(元)      16490      47498      36227      25119      15500   \n",
       "\n",
       "     地区  \n",
       "0   广东省  \n",
       "3    北京  \n",
       "6   上海市  \n",
       "9   浙江省  \n",
       "12  江苏省  "
      ]
     },
     "execution_count": 95,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "居民人均可支配收入累计值 = df_居民人均可支配收入.query('指标==\"居民人均可支配收入累计值(元)\"')\n",
    "居民人均可支配收入累计值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"2ee7717c-a896-4242-b065-0a38da5b964b\" data-root-id=\"13468\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"384d17b2-ac02-45b7-adb6-1b9050164aeb\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"13479\"}],\"center\":[{\"id\":\"13481\"},{\"id\":\"13485\"},{\"id\":\"13528\"}],\"height\":300,\"left\":[{\"id\":\"13482\"}],\"outline_line_color\":null,\"renderers\":[{\"id\":\"13516\"},{\"id\":\"13534\"},{\"id\":\"13551\"},{\"id\":\"13568\"},{\"id\":\"13585\"}],\"title\":{\"id\":\"13469\"},\"toolbar\":{\"id\":\"13494\"},\"x_range\":{\"id\":\"13471\"},\"x_scale\":{\"id\":\"13475\"},\"y_range\":{\"id\":\"13473\"},\"y_scale\":{\"id\":\"13477\"}},\"id\":\"13468\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13504\"}},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#abdda4\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#abdda4\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#abdda4\"},\"top\":{\"expr\":{\"id\":\"13505\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13533\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"13477\",\"type\":\"LinearScale\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"13467\"},\"glyph\":{\"id\":\"13531\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"13533\"},\"name\":\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"nonselection_glyph\":{\"id\":\"13532\"},\"view\":{\"id\":\"13535\"}},\"id\":\"13534\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"tools\":[{\"id\":\"13486\"},{\"id\":\"13487\"},{\"id\":\"13488\"},{\"id\":\"13489\"},{\"id\":\"13490\"},{\"id\":\"13491\"},{\"id\":\"13493\"}]},\"id\":\"13494\",\"type\":\"Toolbar\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"13529\"},{\"id\":\"13546\"},{\"id\":\"13563\"},{\"id\":\"13580\"},{\"id\":\"13597\"}],\"location\":\"top_left\",\"orientation\":\"horizontal\"},\"id\":\"13528\",\"type\":\"Legend\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6\"]},\"id\":\"13510\",\"type\":\"Stack\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13510\"}},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#d7191c\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#d7191c\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#d7191c\"},\"top\":{\"expr\":{\"id\":\"13511\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13584\",\"type\":\"VBar\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\"]},\"id\":\"13504\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"13523\"},\"group\":null,\"major_label_policy\":{\"id\":\"13524\"},\"minor_tick_line_color\":null,\"ticker\":{\"id\":\"13480\"}},\"id\":\"13479\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"source\":{\"id\":\"13467\"}},\"id\":\"13535\",\"type\":\"CDSView\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"13467\"},\"glyph\":{\"id\":\"13582\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"13584\"},\"name\":\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"nonselection_glyph\":{\"id\":\"13583\"},\"view\":{\"id\":\"13586\"}},\"id\":\"13585\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\"]},\"id\":\"13505\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"13480\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"source\":{\"id\":\"13467\"}},\"id\":\"13586\",\"type\":\"CDSView\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13506\"}},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#ffffbf\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#ffffbf\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#ffffbf\"},\"top\":{\"expr\":{\"id\":\"13507\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13550\",\"type\":\"VBar\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13502\"}},\"fill_color\":{\"value\":\"#2b83ba\"},\"hatch_color\":{\"value\":\"#2b83ba\"},\"line_color\":{\"value\":\"#2b83ba\"},\"top\":{\"expr\":{\"id\":\"13503\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13513\",\"type\":\"VBar\"},{\"attributes\":{\"axis\":{\"id\":\"13479\"},\"coordinates\":null,\"grid_line_color\":null,\"group\":null,\"ticker\":null},\"id\":\"13481\",\"type\":\"Grid\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13504\"}},\"fill_color\":{\"value\":\"#abdda4\"},\"hatch_color\":{\"value\":\"#abdda4\"},\"line_color\":{\"value\":\"#abdda4\"},\"top\":{\"expr\":{\"id\":\"13505\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13531\",\"type\":\"VBar\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\"]},\"id\":\"13506\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"13520\"},\"group\":null,\"major_label_policy\":{\"id\":\"13521\"},\"minor_tick_line_color\":null,\"ticker\":{\"id\":\"13483\"}},\"id\":\"13482\",\"type\":\"LinearAxis\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13510\"}},\"fill_color\":{\"value\":\"#d7191c\"},\"hatch_color\":{\"value\":\"#d7191c\"},\"line_color\":{\"value\":\"#d7191c\"},\"top\":{\"expr\":{\"id\":\"13511\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13582\",\"type\":\"VBar\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13504\"}},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#abdda4\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#abdda4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#abdda4\"},\"top\":{\"expr\":{\"id\":\"13505\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13532\",\"type\":\"VBar\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\"]},\"id\":\"13507\",\"type\":\"Stack\"},{\"attributes\":{\"label\":{\"value\":\"2021Q3\"},\"renderers\":[{\"id\":\"13551\"}]},\"id\":\"13563\",\"type\":\"LegendItem\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"13467\"},\"glyph\":{\"id\":\"13548\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"13550\"},\"name\":\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\",\"nonselection_glyph\":{\"id\":\"13549\"},\"view\":{\"id\":\"13552\"}},\"id\":\"13551\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"13483\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\"]},\"id\":\"13508\",\"type\":\"Stack\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13510\"}},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#d7191c\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#d7191c\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#d7191c\"},\"top\":{\"expr\":{\"id\":\"13511\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13583\",\"type\":\"VBar\"},{\"attributes\":{\"axis\":{\"id\":\"13482\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"13485\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"13467\"}},\"id\":\"13552\",\"type\":\"CDSView\"},{\"attributes\":{\"source\":{\"id\":\"13467\"}},\"id\":\"13517\",\"type\":\"CDSView\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13502\"}},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#2b83ba\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#2b83ba\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#2b83ba\"},\"top\":{\"expr\":{\"id\":\"13503\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13515\",\"type\":\"VBar\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"13467\"},\"glyph\":{\"id\":\"13513\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"13515\"},\"name\":\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"nonselection_glyph\":{\"id\":\"13514\"},\"view\":{\"id\":\"13517\"}},\"id\":\"13516\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\"]},\"id\":\"13503\",\"type\":\"Stack\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13506\"}},\"fill_color\":{\"value\":\"#ffffbf\"},\"hatch_color\":{\"value\":\"#ffffbf\"},\"line_color\":{\"value\":\"#ffffbf\"},\"top\":{\"expr\":{\"id\":\"13507\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13548\",\"type\":\"VBar\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6\"]},\"id\":\"13509\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"13520\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13506\"}},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#ffffbf\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#ffffbf\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#ffffbf\"},\"top\":{\"expr\":{\"id\":\"13507\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13549\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"13486\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"13521\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"13487\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data\":{\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\":[12636,19585,21548,18263,15500],\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\":[35694,56498,58907,44712,36227],\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6\":[23604,38138,40357,30998,25119],\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\":[44993,75002,78027,57541,47498],\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\":[13360,20630,22663,19366,16490],\"provinces\":[\"\\u5e7f\\u4e1c\\u7701\",\"\\u5317\\u4eac\",\"\\u4e0a\\u6d77\\u5e02\",\"\\u6d59\\u6c5f\\u7701\",\"\\u6c5f\\u82cf\\u7701\"]},\"selected\":{\"id\":\"13526\"},\"selection_policy\":{\"id\":\"13525\"}},\"id\":\"13467\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13508\"}},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#fdae61\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#fdae61\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#fdae61\"},\"top\":{\"expr\":{\"id\":\"13509\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13567\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"13523\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"13467\"},\"glyph\":{\"id\":\"13565\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"13567\"},\"name\":\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6\",\"nonselection_glyph\":{\"id\":\"13566\"},\"view\":{\"id\":\"13569\"}},\"id\":\"13568\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"overlay\":{\"id\":\"13492\"}},\"id\":\"13488\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"13524\",\"type\":\"AllLabels\"},{\"attributes\":{\"source\":{\"id\":\"13467\"}},\"id\":\"13569\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"13489\",\"type\":\"SaveTool\"},{\"attributes\":{\"fields\":[]},\"id\":\"13502\",\"type\":\"Stack\"},{\"attributes\":{\"label\":{\"value\":\"2021Q1\"},\"renderers\":[{\"id\":\"13585\"}]},\"id\":\"13597\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"13525\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"13490\",\"type\":\"ResetTool\"},{\"attributes\":{\"label\":{\"value\":\"2021Q4\"},\"renderers\":[{\"id\":\"13534\"}]},\"id\":\"13546\",\"type\":\"LegendItem\"},{\"attributes\":{\"label\":{\"value\":\"2021Q2\"},\"renderers\":[{\"id\":\"13568\"}]},\"id\":\"13580\",\"type\":\"LegendItem\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13502\"}},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#2b83ba\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#2b83ba\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#2b83ba\"},\"top\":{\"expr\":{\"id\":\"13503\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13514\",\"type\":\"VBar\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13508\"}},\"fill_color\":{\"value\":\"#fdae61\"},\"hatch_color\":{\"value\":\"#fdae61\"},\"line_color\":{\"value\":\"#fdae61\"},\"top\":{\"expr\":{\"id\":\"13509\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13565\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"13491\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"13526\",\"type\":\"Selection\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\"]},\"id\":\"13511\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\" \\u90e8\\u5206\\u5730\\u533a\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c\"},\"id\":\"13469\",\"type\":\"Title\"},{\"attributes\":{\"label\":{\"value\":\"2022Q1\"},\"renderers\":[{\"id\":\"13516\"}]},\"id\":\"13529\",\"type\":\"LegendItem\"},{\"attributes\":{\"factors\":[\"\\u5e7f\\u4e1c\\u7701\",\"\\u5317\\u4eac\",\"\\u4e0a\\u6d77\\u5e02\",\"\\u6d59\\u6c5f\\u7701\",\"\\u6c5f\\u82cf\\u7701\"],\"range_padding\":0.1},\"id\":\"13471\",\"type\":\"FactorRange\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"13508\"}},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#fdae61\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#fdae61\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#fdae61\"},\"top\":{\"expr\":{\"id\":\"13509\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"provinces\"}},\"id\":\"13566\",\"type\":\"VBar\"},{\"attributes\":{\"end\":300000,\"start\":0},\"id\":\"13473\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c\",\"@provinces @$name\"]]},\"id\":\"13493\",\"type\":\"HoverTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"13492\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"13475\",\"type\":\"CategoricalScale\"}],\"root_ids\":[\"13468\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"384d17b2-ac02-45b7-adb6-1b9050164aeb\",\"root_ids\":[\"13468\"],\"roots\":{\"13468\":\"2ee7717c-a896-4242-b065-0a38da5b964b\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "13468"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.core.properties import value\n",
    "from bokeh.palettes import Spectral5\n",
    "# 数据\n",
    "provinces = df_居民人均可支配收入['地区'].unique()\n",
    "quarters = df_居民人均可支配收入.columns[1:-1]\n",
    "colors = Spectral5\n",
    "data = {'provinces' : provinces,\n",
    "        '2021年第一季度'   : 居民人均可支配收入累计值[\"2021年第一季度\"],\n",
    "        '2021年第二季度'   : 居民人均可支配收入累计值[\"2021年第二季度\"],\n",
    "        '2021年第三季度'   : 居民人均可支配收入累计值[\"2021年第三季度\"],\n",
    "        '2021年第四季度'   : 居民人均可支配收入累计值[\"2021年第四季度\"],\n",
    "        '2022年第一季度'   : 居民人均可支配收入累计值[\"2022年第一季度\"],\n",
    "       }\n",
    "\n",
    "source = ColumnDataSource(\n",
    "    data=data\n",
    ")\n",
    "\n",
    "TOOLTIPS=[\n",
    "    (\"可支配收入累计值\",\"@provinces @$name\")\n",
    "]\n",
    "\n",
    "# 画布\n",
    "p = figure(\n",
    "    x_range=provinces, \n",
    "    plot_height=300, \n",
    "    title=\" 部分地区居民人均可支配收入累计值\",\n",
    "    tooltips=TOOLTIPS\n",
    "           )\n",
    "# 绘图,直接堆叠各年数据\n",
    "p.vbar_stack(quarters, x='provinces', width=0.9, color=colors, source=source,\n",
    "             legend=['2022Q1','2021Q4','2021Q3','2021Q2','2021Q1']) \n",
    "# 其他\n",
    "p.y_range.start = 0\n",
    "p.y_range.end = 300000\n",
    "p.x_range.range_padding = 0.1\n",
    "p.xgrid.grid_line_color = None\n",
    "p.axis.minor_tick_line_color = None\n",
    "p.outline_line_color = None\n",
    "p.legend.location = \"top_left\"\n",
    "p.legend.orientation = \"horizontal\"\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 堆叠柱状图（横向）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### DEMO"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"1b578689-3cf6-41b4-aa75-2b974876ee17\" data-root-id=\"2960\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"032a6dbf-b7e5-4314-a045-0db0f53a6a0b\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"2971\"}],\"center\":[{\"id\":\"2974\"},{\"id\":\"2977\"},{\"id\":\"3015\"}],\"height\":250,\"left\":[{\"id\":\"2975\"}],\"outline_line_color\":null,\"renderers\":[{\"id\":\"3003\"},{\"id\":\"3021\"},{\"id\":\"3038\"}],\"title\":{\"id\":\"2961\"},\"toolbar\":{\"id\":\"2985\"},\"x_range\":{\"id\":\"2963\"},\"x_scale\":{\"id\":\"2967\"},\"y_range\":{\"id\":\"2965\"},\"y_scale\":{\"id\":\"2969\"}},\"id\":\"2960\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2983\",\"type\":\"HelpTool\"},{\"attributes\":{\"end\":16,\"start\":0},\"id\":\"2963\",\"type\":\"DataRange1d\"},{\"attributes\":{\"source\":{\"id\":\"2992\"}},\"id\":\"3022\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"3012\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"Fruit Counts by Year\"},\"id\":\"2961\",\"type\":\"Title\"},{\"attributes\":{\"tools\":[{\"id\":\"2978\"},{\"id\":\"2979\"},{\"id\":\"2980\"},{\"id\":\"2981\"},{\"id\":\"2982\"},{\"id\":\"2983\"}]},\"id\":\"2985\",\"type\":\"Toolbar\"},{\"attributes\":{\"factors\":[\"Apples\",\"Pears\",\"Nectarines\",\"Plums\",\"Grapes\",\"Strawberries\"],\"range_padding\":0.1},\"id\":\"2965\",\"type\":\"FactorRange\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#e84d60\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#e84d60\"},\"height\":{\"value\":0.8},\"left\":{\"expr\":{\"id\":\"2997\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#e84d60\"},\"right\":{\"expr\":{\"id\":\"2998\"}},\"y\":{\"field\":\"fruits\"}},\"id\":\"3036\",\"type\":\"HBar\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"2984\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"2967\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#e84d60\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#e84d60\"},\"height\":{\"value\":0.8},\"left\":{\"expr\":{\"id\":\"2997\"}},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#e84d60\"},\"right\":{\"expr\":{\"id\":\"2998\"}},\"y\":{\"field\":\"fruits\"}},\"id\":\"3037\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"2969\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"source\":{\"id\":\"2992\"}},\"id\":\"3004\",\"type\":\"CDSView\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"3010\"},\"group\":null,\"major_label_policy\":{\"id\":\"3011\"},\"minor_tick_line_color\":null,\"ticker\":{\"id\":\"2972\"}},\"id\":\"2971\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"2992\"}},\"id\":\"3039\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"2017\"},\"renderers\":[{\"id\":\"3038\"}]},\"id\":\"3050\",\"type\":\"LegendItem\"},{\"attributes\":{\"fields\":[\"2015\",\"2016\",\"2017\"]},\"id\":\"2998\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2992\"},\"glyph\":{\"id\":\"3035\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"3037\"},\"name\":\"2017\",\"nonselection_glyph\":{\"id\":\"3036\"},\"view\":{\"id\":\"3039\"}},\"id\":\"3038\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"2972\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fields\":[\"2015\"]},\"id\":\"2994\",\"type\":\"Stack\"},{\"attributes\":{\"axis\":{\"id\":\"2971\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"2974\",\"type\":\"Grid\"},{\"attributes\":{\"fields\":[\"2015\"]},\"id\":\"2995\",\"type\":\"Stack\"},{\"attributes\":{\"fields\":[\"2015\",\"2016\"]},\"id\":\"2996\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"3007\"},\"group\":null,\"major_label_policy\":{\"id\":\"3008\"},\"minor_tick_line_color\":null,\"ticker\":{\"id\":\"2976\"}},\"id\":\"2975\",\"type\":\"CategoricalAxis\"},{\"attributes\":{},\"id\":\"3007\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"fields\":[\"2015\",\"2016\"]},\"id\":\"2997\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"3010\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis\":{\"id\":\"2975\"},\"coordinates\":null,\"dimension\":1,\"grid_line_color\":null,\"group\":null,\"ticker\":null},\"id\":\"2977\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"3011\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"3008\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"3013\",\"type\":\"Selection\"},{\"attributes\":{\"fill_color\":{\"value\":\"#c9d9d3\"},\"hatch_color\":{\"value\":\"#c9d9d3\"},\"height\":{\"value\":0.8},\"left\":{\"expr\":{\"id\":\"2993\"}},\"line_color\":{\"value\":\"#c9d9d3\"},\"right\":{\"expr\":{\"id\":\"2994\"}},\"y\":{\"field\":\"fruits\"}},\"id\":\"3000\",\"type\":\"HBar\"},{\"attributes\":{\"click_policy\":\"hide\",\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"3016\"},{\"id\":\"3033\"},{\"id\":\"3050\"}]},\"id\":\"3015\",\"type\":\"Legend\"},{\"attributes\":{\"label\":{\"value\":\"2015\"},\"renderers\":[{\"id\":\"3003\"}]},\"id\":\"3016\",\"type\":\"LegendItem\"},{\"attributes\":{\"fields\":[]},\"id\":\"2993\",\"type\":\"Stack\"},{\"attributes\":{\"data\":{\"2015\":[2,1,4,3,2,4],\"2016\":[5,3,4,2,4,6],\"2017\":[3,2,4,4,5,3],\"fruits\":[\"Apples\",\"Pears\",\"Nectarines\",\"Plums\",\"Grapes\",\"Strawberries\"]},\"selected\":{\"id\":\"3013\"},\"selection_policy\":{\"id\":\"3012\"}},\"id\":\"2992\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"label\":{\"value\":\"2016\"},\"renderers\":[{\"id\":\"3021\"}]},\"id\":\"3033\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"2978\",\"type\":\"PanTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#c9d9d3\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#c9d9d3\"},\"height\":{\"value\":0.8},\"left\":{\"expr\":{\"id\":\"2993\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#c9d9d3\"},\"right\":{\"expr\":{\"id\":\"2994\"}},\"y\":{\"field\":\"fruits\"}},\"id\":\"3001\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"2979\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2992\"},\"glyph\":{\"id\":\"3000\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"3002\"},\"name\":\"2015\",\"nonselection_glyph\":{\"id\":\"3001\"},\"view\":{\"id\":\"3004\"}},\"id\":\"3003\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2992\"},\"glyph\":{\"id\":\"3018\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"3020\"},\"name\":\"2016\",\"nonselection_glyph\":{\"id\":\"3019\"},\"view\":{\"id\":\"3022\"}},\"id\":\"3021\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_color\":{\"value\":\"#e84d60\"},\"hatch_color\":{\"value\":\"#e84d60\"},\"height\":{\"value\":0.8},\"left\":{\"expr\":{\"id\":\"2997\"}},\"line_color\":{\"value\":\"#e84d60\"},\"right\":{\"expr\":{\"id\":\"2998\"}},\"y\":{\"field\":\"fruits\"}},\"id\":\"3035\",\"type\":\"HBar\"},{\"attributes\":{\"overlay\":{\"id\":\"2984\"}},\"id\":\"2980\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#c9d9d3\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#c9d9d3\"},\"height\":{\"value\":0.8},\"left\":{\"expr\":{\"id\":\"2993\"}},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#c9d9d3\"},\"right\":{\"expr\":{\"id\":\"2994\"}},\"y\":{\"field\":\"fruits\"}},\"id\":\"3002\",\"type\":\"HBar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#718dbf\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#718dbf\"},\"height\":{\"value\":0.8},\"left\":{\"expr\":{\"id\":\"2995\"}},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#718dbf\"},\"right\":{\"expr\":{\"id\":\"2996\"}},\"y\":{\"field\":\"fruits\"}},\"id\":\"3020\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"2981\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"2976\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"fill_color\":{\"value\":\"#718dbf\"},\"hatch_color\":{\"value\":\"#718dbf\"},\"height\":{\"value\":0.8},\"left\":{\"expr\":{\"id\":\"2995\"}},\"line_color\":{\"value\":\"#718dbf\"},\"right\":{\"expr\":{\"id\":\"2996\"}},\"y\":{\"field\":\"fruits\"}},\"id\":\"3018\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"2982\",\"type\":\"ResetTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#718dbf\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#718dbf\"},\"height\":{\"value\":0.8},\"left\":{\"expr\":{\"id\":\"2995\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#718dbf\"},\"right\":{\"expr\":{\"id\":\"2996\"}},\"y\":{\"field\":\"fruits\"}},\"id\":\"3019\",\"type\":\"HBar\"}],\"root_ids\":[\"2960\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"032a6dbf-b7e5-4314-a045-0db0f53a6a0b\",\"root_ids\":[\"2960\"],\"roots\":{\"2960\":\"1b578689-3cf6-41b4-aa75-2b974876ee17\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "2960"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.models import Legend\n",
    "p = figure(y_range=fruits, plot_height=250,title=\"Fruit Counts by Year\",\n",
    "#            toolbar_location=None, tools=\"\"\n",
    "          )\n",
    "source = ColumnDataSource(data=data)\n",
    "p.hbar_stack(years, y='fruits',height=0.8, color=colors, source=source,\n",
    "            legend=[value(x) for x in years] )  # 堆叠柱状图，逐年堆叠\n",
    "p.x_range.start = 0\n",
    "p.x_range.end = 16\n",
    "p.y_range.range_padding = 0.1 # x轴两侧空白\n",
    "p.ygrid.grid_line_color = None\n",
    "p.axis.minor_tick_line_color = None\n",
    "p.outline_line_color = None\n",
    "p.legend.location = \"top_right\"\n",
    "# p.legend.orientation = \"horizontal\"\n",
    "p.legend.click_policy=\"hide\"\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"4885ab58-9574-4d45-b0df-6d2b50190e8c\" data-root-id=\"17222\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"a4def8b9-fad0-43ad-a74b-a4e413f53eec\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"17233\"}],\"center\":[{\"id\":\"17236\"},{\"id\":\"17239\"},{\"id\":\"17282\"}],\"height\":300,\"left\":[{\"id\":\"17237\"}],\"outline_line_color\":null,\"renderers\":[{\"id\":\"17270\"},{\"id\":\"17288\"},{\"id\":\"17305\"},{\"id\":\"17322\"},{\"id\":\"17339\"}],\"title\":{\"id\":\"17223\"},\"toolbar\":{\"id\":\"17248\"},\"x_range\":{\"id\":\"17225\"},\"x_scale\":{\"id\":\"17229\"},\"y_range\":{\"id\":\"17227\"},\"y_scale\":{\"id\":\"17231\"}},\"id\":\"17222\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"fields\":[]},\"id\":\"17256\",\"type\":\"Stack\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\"]},\"id\":\"17257\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"17243\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"17278\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"17244\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"17245\",\"type\":\"HelpTool\"},{\"attributes\":{\"fill_color\":{\"value\":\"#2b83ba\"},\"hatch_color\":{\"value\":\"#2b83ba\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17256\"}},\"line_color\":{\"value\":\"#2b83ba\"},\"right\":{\"expr\":{\"id\":\"17257\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17267\",\"type\":\"HBar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#2b83ba\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#2b83ba\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17256\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#2b83ba\"},\"right\":{\"expr\":{\"id\":\"17257\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17268\",\"type\":\"HBar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#fdae61\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#fdae61\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17262\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#fdae61\"},\"right\":{\"expr\":{\"id\":\"17263\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17320\",\"type\":\"HBar\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c\",\"@provinces @$name\"]]},\"id\":\"17247\",\"type\":\"HoverTool\"},{\"attributes\":{\"tools\":[{\"id\":\"17240\"},{\"id\":\"17241\"},{\"id\":\"17242\"},{\"id\":\"17243\"},{\"id\":\"17244\"},{\"id\":\"17245\"},{\"id\":\"17247\"}]},\"id\":\"17248\",\"type\":\"Toolbar\"},{\"attributes\":{\"label\":{\"value\":\"2021Q2\"},\"renderers\":[{\"id\":\"17322\"}]},\"id\":\"17334\",\"type\":\"LegendItem\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"17221\"},\"glyph\":{\"id\":\"17267\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"17269\"},\"name\":\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"nonselection_glyph\":{\"id\":\"17268\"},\"view\":{\"id\":\"17271\"}},\"id\":\"17270\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"17221\"}},\"id\":\"17323\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"17280\",\"type\":\"Selection\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"17221\"},\"glyph\":{\"id\":\"17319\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"17321\"},\"name\":\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6\",\"nonselection_glyph\":{\"id\":\"17320\"},\"view\":{\"id\":\"17323\"}},\"id\":\"17322\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"17246\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"axis\":{\"id\":\"17233\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"17236\",\"type\":\"Grid\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#fdae61\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#fdae61\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17262\"}},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#fdae61\"},\"right\":{\"expr\":{\"id\":\"17263\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17321\",\"type\":\"HBar\"},{\"attributes\":{\"axis\":{\"id\":\"17237\"},\"coordinates\":null,\"dimension\":1,\"grid_line_color\":null,\"group\":null,\"ticker\":null},\"id\":\"17239\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"17240\",\"type\":\"PanTool\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\"]},\"id\":\"17258\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"17238\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"label\":{\"value\":\"2021Q3\"},\"renderers\":[{\"id\":\"17305\"}]},\"id\":\"17317\",\"type\":\"LegendItem\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\"]},\"id\":\"17259\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"17274\"},\"group\":null,\"major_label_policy\":{\"id\":\"17275\"},\"minor_tick_line_color\":null,\"ticker\":{\"id\":\"17238\"}},\"id\":\"17237\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#abdda4\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#abdda4\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17258\"}},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#abdda4\"},\"right\":{\"expr\":{\"id\":\"17259\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17287\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"17277\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_color\":{\"value\":\"#abdda4\"},\"hatch_color\":{\"value\":\"#abdda4\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17258\"}},\"line_color\":{\"value\":\"#abdda4\"},\"right\":{\"expr\":{\"id\":\"17259\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17285\",\"type\":\"HBar\"},{\"attributes\":{\"end\":300000,\"start\":0},\"id\":\"17225\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#abdda4\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#abdda4\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17258\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#abdda4\"},\"right\":{\"expr\":{\"id\":\"17259\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17286\",\"type\":\"HBar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#d7191c\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#d7191c\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17264\"}},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#d7191c\"},\"right\":{\"expr\":{\"id\":\"17265\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17338\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"17234\",\"type\":\"BasicTicker\"},{\"attributes\":{\"label\":{\"value\":\"2021Q4\"},\"renderers\":[{\"id\":\"17288\"}]},\"id\":\"17300\",\"type\":\"LegendItem\"},{\"attributes\":{\"label\":{\"value\":\"2021Q1\"},\"renderers\":[{\"id\":\"17339\"}]},\"id\":\"17351\",\"type\":\"LegendItem\"},{\"attributes\":{\"fill_color\":{\"value\":\"#d7191c\"},\"hatch_color\":{\"value\":\"#d7191c\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17264\"}},\"line_color\":{\"value\":\"#d7191c\"},\"right\":{\"expr\":{\"id\":\"17265\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17336\",\"type\":\"HBar\"},{\"attributes\":{\"source\":{\"id\":\"17221\"}},\"id\":\"17289\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#d7191c\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#d7191c\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17264\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#d7191c\"},\"right\":{\"expr\":{\"id\":\"17265\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17337\",\"type\":\"HBar\"},{\"attributes\":{\"data\":{\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\":[12636,19585,21548,18263,15500],\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\":[35694,56498,58907,44712,36227],\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6\":[23604,38138,40357,30998,25119],\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\":[44993,75002,78027,57541,47498],\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\":[13360,20630,22663,19366,16490],\"provinces\":[\"\\u5e7f\\u4e1c\\u7701\",\"\\u5317\\u4eac\",\"\\u4e0a\\u6d77\\u5e02\",\"\\u6d59\\u6c5f\\u7701\",\"\\u6c5f\\u82cf\\u7701\"]},\"selected\":{\"id\":\"17280\"},\"selection_policy\":{\"id\":\"17279\"}},\"id\":\"17221\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"17221\"}},\"id\":\"17271\",\"type\":\"CDSView\"},{\"attributes\":{\"source\":{\"id\":\"17221\"}},\"id\":\"17340\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"17241\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"17221\"},\"glyph\":{\"id\":\"17285\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"17287\"},\"name\":\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"nonselection_glyph\":{\"id\":\"17286\"},\"view\":{\"id\":\"17289\"}},\"id\":\"17288\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"17277\"},\"group\":null,\"major_label_policy\":{\"id\":\"17278\"},\"minor_tick_line_color\":null,\"ticker\":{\"id\":\"17234\"}},\"id\":\"17233\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"17274\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\"]},\"id\":\"17260\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"17231\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#ffffbf\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#ffffbf\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17260\"}},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#ffffbf\"},\"right\":{\"expr\":{\"id\":\"17261\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17303\",\"type\":\"HBar\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"17221\"},\"glyph\":{\"id\":\"17336\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"17338\"},\"name\":\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"nonselection_glyph\":{\"id\":\"17337\"},\"view\":{\"id\":\"17340\"}},\"id\":\"17339\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\"]},\"id\":\"17261\",\"type\":\"Stack\"},{\"attributes\":{\"label\":{\"value\":\"2022Q1\"},\"renderers\":[{\"id\":\"17270\"}]},\"id\":\"17283\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"17229\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"17275\",\"type\":\"AllLabels\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\"]},\"id\":\"17262\",\"type\":\"Stack\"},{\"attributes\":{\"factors\":[\"\\u5e7f\\u4e1c\\u7701\",\"\\u5317\\u4eac\",\"\\u4e0a\\u6d77\\u5e02\",\"\\u6d59\\u6c5f\\u7701\",\"\\u6c5f\\u82cf\\u7701\"],\"range_padding\":0.1},\"id\":\"17227\",\"type\":\"FactorRange\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#ffffbf\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#ffffbf\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17260\"}},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#ffffbf\"},\"right\":{\"expr\":{\"id\":\"17261\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17304\",\"type\":\"HBar\"},{\"attributes\":{\"fill_color\":{\"value\":\"#fdae61\"},\"hatch_color\":{\"value\":\"#fdae61\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17262\"}},\"line_color\":{\"value\":\"#fdae61\"},\"right\":{\"expr\":{\"id\":\"17263\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17319\",\"type\":\"HBar\"},{\"attributes\":{\"fill_color\":{\"value\":\"#ffffbf\"},\"hatch_color\":{\"value\":\"#ffffbf\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17260\"}},\"line_color\":{\"value\":\"#ffffbf\"},\"right\":{\"expr\":{\"id\":\"17261\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17302\",\"type\":\"HBar\"},{\"attributes\":{\"overlay\":{\"id\":\"17246\"}},\"id\":\"17242\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6\"]},\"id\":\"17263\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"17221\"},\"glyph\":{\"id\":\"17302\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"17304\"},\"name\":\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\",\"nonselection_glyph\":{\"id\":\"17303\"},\"view\":{\"id\":\"17306\"}},\"id\":\"17305\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"17279\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"source\":{\"id\":\"17221\"}},\"id\":\"17306\",\"type\":\"CDSView\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6\"]},\"id\":\"17264\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\" \\u90e8\\u5206\\u5730\\u533a\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c\"},\"id\":\"17223\",\"type\":\"Title\"},{\"attributes\":{\"fields\":[\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6\",\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\"]},\"id\":\"17265\",\"type\":\"Stack\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"17283\"},{\"id\":\"17300\"},{\"id\":\"17317\"},{\"id\":\"17334\"},{\"id\":\"17351\"}]},\"id\":\"17282\",\"type\":\"Legend\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#2b83ba\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#2b83ba\"},\"height\":{\"value\":0.7},\"left\":{\"expr\":{\"id\":\"17256\"}},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#2b83ba\"},\"right\":{\"expr\":{\"id\":\"17257\"}},\"y\":{\"field\":\"provinces\"}},\"id\":\"17269\",\"type\":\"HBar\"}],\"root_ids\":[\"17222\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"a4def8b9-fad0-43ad-a74b-a4e413f53eec\",\"root_ids\":[\"17222\"],\"roots\":{\"17222\":\"4885ab58-9574-4d45-b0df-6d2b50190e8c\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "17222"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 数据\n",
    "provinces = df_居民人均可支配收入['地区'].unique()\n",
    "quarters = df_居民人均可支配收入.columns[1:-1]\n",
    "colors = Spectral5\n",
    "data = {'provinces' : provinces,\n",
    "        '2021年第一季度'   : 居民人均可支配收入累计值[\"2021年第一季度\"],\n",
    "        '2021年第二季度'   : 居民人均可支配收入累计值[\"2021年第二季度\"],\n",
    "        '2021年第三季度'   : 居民人均可支配收入累计值[\"2021年第三季度\"],\n",
    "        '2021年第四季度'   : 居民人均可支配收入累计值[\"2021年第四季度\"],\n",
    "        '2022年第一季度'   : 居民人均可支配收入累计值[\"2022年第一季度\"],\n",
    "       }\n",
    "\n",
    "source = ColumnDataSource(\n",
    "    data=data\n",
    ")\n",
    "\n",
    "TOOLTIPS=[\n",
    "    (\"可支配收入累计值\",\"@provinces @$name\")\n",
    "]\n",
    "\n",
    "# 画布\n",
    "p = figure(\n",
    "    y_range=provinces, \n",
    "    plot_height=300, \n",
    "    title=\" 部分地区居民人均可支配收入累计值\",\n",
    "    tooltips=TOOLTIPS\n",
    "           )\n",
    "# 绘图,直接堆叠各年数据\n",
    "p.hbar_stack(quarters, y='provinces', height=0.7, color=colors, source=source,\n",
    "             legend=['2022Q1','2021Q4','2021Q3','2021Q2','2021Q1']) \n",
    "# 其他\n",
    "p.x_range.start = 0\n",
    "p.x_range.end = 300000\n",
    "p.y_range.range_padding = 0.1\n",
    "p.ygrid.grid_line_color = None\n",
    "p.axis.minor_tick_line_color = None\n",
    "p.outline_line_color = None\n",
    "p.legend.location = \"top_right\"\n",
    "\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## groupby 数据展示\n",
    "* 实践，不同车企的 groupby 数据展示"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>mpg</th>\n",
       "      <th>cyl</th>\n",
       "      <th>displ</th>\n",
       "      <th>hp</th>\n",
       "      <th>weight</th>\n",
       "      <th>accel</th>\n",
       "      <th>yr</th>\n",
       "      <th>origin</th>\n",
       "      <th>name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>18.0</td>\n",
       "      <td>8</td>\n",
       "      <td>307.0</td>\n",
       "      <td>130</td>\n",
       "      <td>3504</td>\n",
       "      <td>12.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>chevrolet chevelle malibu</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>15.0</td>\n",
       "      <td>8</td>\n",
       "      <td>350.0</td>\n",
       "      <td>165</td>\n",
       "      <td>3693</td>\n",
       "      <td>11.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>buick skylark 320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>18.0</td>\n",
       "      <td>8</td>\n",
       "      <td>318.0</td>\n",
       "      <td>150</td>\n",
       "      <td>3436</td>\n",
       "      <td>11.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>plymouth satellite</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>16.0</td>\n",
       "      <td>8</td>\n",
       "      <td>304.0</td>\n",
       "      <td>150</td>\n",
       "      <td>3433</td>\n",
       "      <td>12.0</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>amc rebel sst</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>17.0</td>\n",
       "      <td>8</td>\n",
       "      <td>302.0</td>\n",
       "      <td>140</td>\n",
       "      <td>3449</td>\n",
       "      <td>10.5</td>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>ford torino</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>387</th>\n",
       "      <td>27.0</td>\n",
       "      <td>4</td>\n",
       "      <td>140.0</td>\n",
       "      <td>86</td>\n",
       "      <td>2790</td>\n",
       "      <td>15.6</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>ford mustang gl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>388</th>\n",
       "      <td>44.0</td>\n",
       "      <td>4</td>\n",
       "      <td>97.0</td>\n",
       "      <td>52</td>\n",
       "      <td>2130</td>\n",
       "      <td>24.6</td>\n",
       "      <td>82</td>\n",
       "      <td>2</td>\n",
       "      <td>vw pickup</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>389</th>\n",
       "      <td>32.0</td>\n",
       "      <td>4</td>\n",
       "      <td>135.0</td>\n",
       "      <td>84</td>\n",
       "      <td>2295</td>\n",
       "      <td>11.6</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>dodge rampage</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>390</th>\n",
       "      <td>28.0</td>\n",
       "      <td>4</td>\n",
       "      <td>120.0</td>\n",
       "      <td>79</td>\n",
       "      <td>2625</td>\n",
       "      <td>18.6</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>ford ranger</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>391</th>\n",
       "      <td>31.0</td>\n",
       "      <td>4</td>\n",
       "      <td>119.0</td>\n",
       "      <td>82</td>\n",
       "      <td>2720</td>\n",
       "      <td>19.4</td>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>chevy s-10</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>392 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      mpg cyl  displ   hp  weight  accel  yr  origin  \\\n",
       "0    18.0   8  307.0  130    3504   12.0  70       1   \n",
       "1    15.0   8  350.0  165    3693   11.5  70       1   \n",
       "2    18.0   8  318.0  150    3436   11.0  70       1   \n",
       "3    16.0   8  304.0  150    3433   12.0  70       1   \n",
       "4    17.0   8  302.0  140    3449   10.5  70       1   \n",
       "..    ...  ..    ...  ...     ...    ...  ..     ...   \n",
       "387  27.0   4  140.0   86    2790   15.6  82       1   \n",
       "388  44.0   4   97.0   52    2130   24.6  82       2   \n",
       "389  32.0   4  135.0   84    2295   11.6  82       1   \n",
       "390  28.0   4  120.0   79    2625   18.6  82       1   \n",
       "391  31.0   4  119.0   82    2720   19.4  82       1   \n",
       "\n",
       "                          name  \n",
       "0    chevrolet chevelle malibu  \n",
       "1            buick skylark 320  \n",
       "2           plymouth satellite  \n",
       "3                amc rebel sst  \n",
       "4                  ford torino  \n",
       "..                         ...  \n",
       "387            ford mustang gl  \n",
       "388                  vw pickup  \n",
       "389              dodge rampage  \n",
       "390                ford ranger  \n",
       "391                 chevy s-10  \n",
       "\n",
       "[392 rows x 9 columns]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 数据准备\n",
    "from bokeh.sampledata.autompg import autompg as df\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "--------\n",
    "* MPG（英里） by  Cylinders（缸）\n",
    "* 1英里 = 1.60公里 1英制加仑 = 4.54升"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"517ab3a9-eeaa-42c0-ab67-87e0898b46b5\" data-root-id=\"1347\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"f0f32b8b-a1d3-4db2-9de7-3373406f3ddd\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1358\"}],\"center\":[{\"id\":\"1360\"},{\"id\":\"1364\"}],\"height\":350,\"left\":[{\"id\":\"1361\"}],\"outline_line_color\":null,\"renderers\":[{\"id\":\"1384\"}],\"title\":{\"id\":\"1348\"},\"toolbar\":{\"id\":\"1372\"},\"x_range\":{\"id\":\"1350\"},\"x_scale\":{\"id\":\"1354\"},\"y_range\":{\"id\":\"1352\"},\"y_scale\":{\"id\":\"1356\"}},\"id\":\"1347\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"axis\":{\"id\":\"1361\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1364\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1418\",\"type\":\"Selection\"},{\"attributes\":{\"factors\":[\"3\",\"4\",\"5\",\"6\",\"8\"],\"palette\":[\"#2b83ba\",\"#abdda4\",\"#ffffbf\",\"#fdae61\",\"#d7191c\"]},\"id\":\"1346\",\"type\":\"CategoricalColorMapper\"},{\"attributes\":{\"data\":{\"accel_25%\":{\"__ndarray__\":\"AAAAAACAKkCamZmZmZktQGZmZmZm5jFAmpmZmZkZLkAAAAAAAAAnQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"accel_50%\":{\"__ndarray__\":\"AAAAAAAAK0AzMzMzMzMwQGZmZmZm5jNAAAAAAAAAMEAAAAAAAAAqQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"accel_75%\":{\"__ndarray__\":\"AAAAAAAAK0AAAAAAAAAyQAAAAAAAADRAmpmZmZmZMUAAAAAAAAAsQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"accel_count\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAOBoQAAAAAAAAAhAAAAAAADAVEAAAAAAAMBZQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"accel_max\":{\"__ndarray__\":\"AAAAAAAAK0DNzMzMzMw4QJqZmZmZGTRAAAAAAAAANUAzMzMzMzM2QA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"accel_mean\":{\"__ndarray__\":\"AAAAAACAKkCSxCwG+JQwQCIiIiIiojJA7d9LWxRBMEBCLI1MIukpQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"accel_min\":{\"__ndarray__\":\"AAAAAAAAKUAzMzMzMzMnQM3MzMzMzC9AmpmZmZmZJkAAAAAAAAAgQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"accel_std\":{\"__ndarray__\":\"AAAAAAAA4D+Y1TA5wxADQO1jrP039AJA0StM4BRBAEABZ5ysTswBQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"cyl\":[\"3\",\"4\",\"5\",\"6\",\"8\"],\"displ_25%\":{\"__ndarray__\":\"AAAAAACAUUAAAAAAAMBWQAAAAAAAgF9AAAAAAADwaEAAAAAAABBzQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"displ_50%\":{\"__ndarray__\":\"AAAAAACAUUAAAAAAAEBaQAAAAAAAYGBAAAAAAADgbEAAAAAAAOB1QA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"displ_75%\":{\"__ndarray__\":\"AAAAAAAgUkAAAAAAAEBeQAAAAAAAoGNAAAAAAABAb0AAAAAAAIB2QA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"displ_count\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAOBoQAAAAAAAAAhAAAAAAADAVEAAAAAAAMBZQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"displ_max\":{\"__ndarray__\":\"AAAAAAAAVEAAAAAAAIBjQAAAAAAA4GZAAAAAAABgcEAAAAAAAHB8QA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"displ_mean\":{\"__ndarray__\":\"AAAAAAAgUkD/9sBG72pbQAAAAAAAIGJAmjq/9pBLa0DJeVnEJ5B1QA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"displ_min\":{\"__ndarray__\":\"AAAAAACAUUAAAAAAAABRQAAAAAAAQF5AAAAAAAAgYkAAAAAAAEBwQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"displ_std\":{\"__ndarray__\":\"AAAAAAAAFEC9furRdmA1QLmT4WuwpEBAT4BvAbA2QEDXs8ZGYGNHQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"hp_25%\":{\"__ndarray__\":\"AAAAAADQV0AAAAAAAABRQAAAAAAAAFJAAAAAAAAgV0AAAAAAAIBhQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"hp_50%\":{\"__ndarray__\":\"AAAAAACgWEAAAAAAAIBTQAAAAAAAQFNAAAAAAAAAWUAAAAAAAMBiQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"hp_75%\":{\"__ndarray__\":\"AAAAAACgWUAAAAAAAABWQAAAAAAAgFZAAAAAAACAW0AAAAAAAOBlQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"hp_count\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAOBoQAAAAAAAAAhAAAAAAADAVEAAAAAAAMBZQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"hp_max\":{\"__ndarray__\":\"AAAAAACAW0AAAAAAAMBcQAAAAAAAwFlAAAAAAACgZEAAAAAAAMBsQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"hp_mean\":{\"__ndarray__\":\"AAAAAADQWEB2PKeSApJTQFVVVVVVlVRAsD3ksmJgWUDCfquNocljQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"hp_min\":{\"__ndarray__\":\"AAAAAACAVkAAAAAAAABHQAAAAAAAwFBAAAAAAAAAUkAAAAAAAIBWQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"hp_std\":{\"__ndarray__\":\"sTIWI2yaIECEr0Go0wstQDKsjxZJlTJAxZAwIvaeLEBPwZb3G3Q8QA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"mpg_25%\":{\"__ndarray__\":\"AAAAAADAMkAAAAAAAAA5QJqZmZmZ2TZAAAAAAAAAMkAAAAAAAAAqQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"mpg_50%\":{\"__ndarray__\":\"AAAAAABANEBmZmZmZmY8QGZmZmZmZjlAAAAAAAAAM0AAAAAAAAAsQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"mpg_75%\":{\"__ndarray__\":\"zczMzMwMNkCamZmZmXlAQGZmZmZm5j5AAAAAAAAANUAAAAAAAAAwQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"mpg_count\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAOBoQAAAAAAAAAhAAAAAAADAVEAAAAAAAMBZQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"mpg_max\":{\"__ndarray__\":\"MzMzMzOzN0DNzMzMzExHQDMzMzMzM0JAAAAAAAAAQ0CamZmZmZk6QA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"mpg_mean\":{\"__ndarray__\":\"zczMzMyMNEByD2z0rkg9QN3d3d3dXTtA6lu15jb5M0BhwH9VHO0tQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"mpg_min\":{\"__ndarray__\":\"AAAAAAAAMkAAAAAAAAAyQM3MzMzMTDRAAAAAAAAALkAAAAAAAAAiQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"mpg_std\":{\"__ndarray__\":\"ca9eOxmEBECNLXOmo64WQOWG1RfXdCBALURKf2ahDkC3cW7BtbAGQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"origin_25%\":{\"__ndarray__\":\"AAAAAAAACEAAAAAAAADwPwAAAAAAAABAAAAAAAAA8D8AAAAAAADwPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"origin_50%\":{\"__ndarray__\":\"AAAAAAAACEAAAAAAAAAAQAAAAAAAAABAAAAAAAAA8D8AAAAAAADwPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"origin_75%\":{\"__ndarray__\":\"AAAAAAAACEAAAAAAAAAIQAAAAAAAAABAAAAAAAAA8D8AAAAAAADwPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"origin_count\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAOBoQAAAAAAAAAhAAAAAAADAVEAAAAAAAMBZQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"origin_max\":{\"__ndarray__\":\"AAAAAAAACEAAAAAAAAAIQAAAAAAAAABAAAAAAAAACEAAAAAAAADwPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"origin_mean\":{\"__ndarray__\":\"AAAAAAAACEAAAAAAAAAAQAAAAAAAAABAdX7tIZcV8z8AAAAAAADwPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"origin_min\":{\"__ndarray__\":\"AAAAAAAACEAAAAAAAADwPwAAAAAAAABAAAAAAAAA8D8AAAAAAADwPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"origin_std\":{\"__ndarray__\":\"AAAAAAAAAACo00pJEbfqPwAAAAAAAAAAPS9VpaOj4T8AAAAAAAAAAA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"weight_25%\":{\"__ndarray__\":\"AAAAAADNoUAAAAAAAP6fQAAAAAAAlKZAAAAAAAACp0AAAAAAAK6tQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"weight_50%\":{\"__ndarray__\":\"AAAAAACOokAAAAAAAGyhQAAAAAAADKdAAAAAAAAUqUAAAAAAACywQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"weight_75%\":{\"__ndarray__\":\"AAAAAAB+o0AAAAAAAAWkQAAAAAAAUKlAAAAAAADOqkAAAAAAgDOxQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"weight_count\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAOBoQAAAAAAAAAhAAAAAAADAVEAAAAAAAMBZQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"weight_max\":{\"__ndarray__\":\"AAAAAABApUAAAAAAAIypQAAAAAAAlKtAAAAAAACGrkAAAAAAABS0QA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"weight_mean\":{\"__ndarray__\":\"AAAAAAC9okAsMl+aOAKiQKuqqqqqPqhAjqbOrz0EqUBD0x3stxKwQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"weight_min\":{\"__ndarray__\":\"AAAAAACYoEAAAAAAADSZQAAAAAAAHKZAAAAAAABQo0AAAAAAAByoQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"weight_std\":{\"__ndarray__\":\"udhs7B3ybkC7+VSg9G11QA9pSX6AZXdAdmeNgiLGdEC9UR6eVA18QA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"yr_25%\":{\"__ndarray__\":\"AAAAAAAwUkAAAAAAAIBSQAAAAAAAoFNAAAAAAACAUkAAAAAAAABSQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"yr_50%\":{\"__ndarray__\":\"AAAAAADAUkAAAAAAAEBTQAAAAAAAwFNAAAAAAAAAU0AAAAAAAEBSQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"yr_75%\":{\"__ndarray__\":\"AAAAAABwU0AAAAAAAABUQAAAAAAA4FNAAAAAAACAU0AAAAAAAABTQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"yr_count\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAOBoQAAAAAAAAAhAAAAAAADAVEAAAAAAAMBZQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"yr_max\":{\"__ndarray__\":\"AAAAAAAAVEAAAAAAAIBUQAAAAAAAAFRAAAAAAACAVEAAAAAAAEBUQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"yr_mean\":{\"__ndarray__\":\"AAAAAADgUkDEWG397UFTQAAAAAAAwFNAghLeaOr8UkCL+ARSyXlSQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"yr_min\":{\"__ndarray__\":\"AAAAAAAAUkAAAAAAAIBRQAAAAAAAgFNAAAAAAACAUUAAAAAAAIBRQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]},\"yr_std\":{\"__ndarray__\":\"p1MQvCOTDUAe5PLGXeYNQAAAAAAAAPA/p0OY+nMdCkABv1x2cisIQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[5]}},\"selected\":{\"id\":\"1418\"},\"selection_policy\":{\"id\":\"1417\"}},\"id\":\"1379\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1417\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1365\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1416\",\"type\":\"AllLabels\"},{\"attributes\":{\"start\":0},\"id\":\"1352\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1415\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{},\"id\":\"1366\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"MPG by # Cylinders\"},\"id\":\"1348\",\"type\":\"Title\"},{\"attributes\":{\"overlay\":{\"id\":\"1371\"}},\"id\":\"1367\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"1412\"},\"group\":null,\"major_label_policy\":{\"id\":\"1413\"},\"ticker\":{\"id\":\"1362\"}},\"id\":\"1361\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1368\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1413\",\"type\":\"AllLabels\"},{\"attributes\":{\"factors\":[\"3\",\"4\",\"5\",\"6\",\"8\"]},\"id\":\"1350\",\"type\":\"FactorRange\"},{\"attributes\":{},\"id\":\"1369\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1412\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1370\",\"type\":\"HelpTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"field\":\"cyl\",\"transform\":{\"id\":\"1346\"}},\"hatch_alpha\":{\"value\":0.1},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"field\":\"cyl\",\"transform\":{\"id\":\"1346\"}},\"top\":{\"field\":\"mpg_mean\"},\"width\":{\"value\":0.9},\"x\":{\"field\":\"cyl\"}},\"id\":\"1382\",\"type\":\"VBar\"},{\"attributes\":{\"tools\":[{\"id\":\"1365\"},{\"id\":\"1366\"},{\"id\":\"1367\"},{\"id\":\"1368\"},{\"id\":\"1369\"},{\"id\":\"1370\"}]},\"id\":\"1372\",\"type\":\"Toolbar\"},{\"attributes\":{\"fill_color\":{\"field\":\"cyl\",\"transform\":{\"id\":\"1346\"}},\"line_color\":{\"field\":\"cyl\",\"transform\":{\"id\":\"1346\"}},\"top\":{\"field\":\"mpg_mean\"},\"width\":{\"value\":0.9},\"x\":{\"field\":\"cyl\"}},\"id\":\"1381\",\"type\":\"VBar\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1371\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1354\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"source\":{\"id\":\"1379\"}},\"id\":\"1385\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1356\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis_label\":\"some stuff\",\"coordinates\":null,\"formatter\":{\"id\":\"1415\"},\"group\":null,\"major_label_orientation\":1.2,\"major_label_policy\":{\"id\":\"1416\"},\"ticker\":{\"id\":\"1359\"}},\"id\":\"1358\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"field\":\"cyl\",\"transform\":{\"id\":\"1346\"}},\"hatch_alpha\":{\"value\":0.2},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"field\":\"cyl\",\"transform\":{\"id\":\"1346\"}},\"top\":{\"field\":\"mpg_mean\"},\"width\":{\"value\":0.9},\"x\":{\"field\":\"cyl\"}},\"id\":\"1383\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"1359\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1379\"},\"glyph\":{\"id\":\"1381\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1383\"},\"nonselection_glyph\":{\"id\":\"1382\"},\"view\":{\"id\":\"1385\"}},\"id\":\"1384\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis\":{\"id\":\"1358\"},\"coordinates\":null,\"grid_line_color\":null,\"group\":null,\"ticker\":null},\"id\":\"1360\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1362\",\"type\":\"BasicTicker\"}],\"root_ids\":[\"1347\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"f0f32b8b-a1d3-4db2-9de7-3373406f3ddd\",\"root_ids\":[\"1347\"],\"roots\":{\"1347\":\"517ab3a9-eeaa-42c0-ab67-87e0898b46b5\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1347"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.palettes import Spectral5\n",
    "from bokeh.sampledata.autompg import autompg as df\n",
    "from bokeh.transform import factor_cmap\n",
    "# 数据,预处理\n",
    "df.cyl = df.cyl.astype(str)\n",
    "group = df.groupby('cyl')\n",
    "cyl_cmap = factor_cmap('cyl', palette=Spectral5, factors=sorted(df.cyl.unique())) # 分组颜色映射\n",
    "# 画布\n",
    "p = figure(plot_height=350, x_range=group, title=\"MPG by # Cylinders\",\n",
    "#            toolbar_location=None, tools=\"\"\n",
    "          )\n",
    "# 绘图\n",
    "p.vbar(x='cyl', top='mpg_mean', width=0.9, source=group,\n",
    "       line_color=cyl_cmap, fill_color=cyl_cmap)\n",
    "# 其他\n",
    "p.y_range.start = 0\n",
    "p.xgrid.grid_line_color = None\n",
    "p.xaxis.axis_label = \"some stuff\"\n",
    "p.xaxis.major_label_orientation = 1.2\n",
    "p.outline_line_color = None\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 193,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>mpg</th>\n",
       "      <th>cyl</th>\n",
       "      <th>displ</th>\n",
       "      <th>hp</th>\n",
       "      <th>weight</th>\n",
       "      <th>accel</th>\n",
       "      <th>yr</th>\n",
       "      <th>origin</th>\n",
       "      <th>name</th>\n",
       "      <th>mfr</th>\n",
       "      <th>2022年第一季度</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>18.0</td>\n",
       "      <td>8</td>\n",
       "      <td>307.0</td>\n",
       "      <td>130</td>\n",
       "      <td>3504</td>\n",
       "      <td>12.0</td>\n",
       "      <td>70</td>\n",
       "      <td>North America</td>\n",
       "      <td>chevrolet chevelle malibu</td>\n",
       "      <td>chevrolet</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>15.0</td>\n",
       "      <td>8</td>\n",
       "      <td>350.0</td>\n",
       "      <td>165</td>\n",
       "      <td>3693</td>\n",
       "      <td>11.5</td>\n",
       "      <td>70</td>\n",
       "      <td>North America</td>\n",
       "      <td>buick skylark 320</td>\n",
       "      <td>buick</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>18.0</td>\n",
       "      <td>8</td>\n",
       "      <td>318.0</td>\n",
       "      <td>150</td>\n",
       "      <td>3436</td>\n",
       "      <td>11.0</td>\n",
       "      <td>70</td>\n",
       "      <td>North America</td>\n",
       "      <td>plymouth satellite</td>\n",
       "      <td>plymouth</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>16.0</td>\n",
       "      <td>8</td>\n",
       "      <td>304.0</td>\n",
       "      <td>150</td>\n",
       "      <td>3433</td>\n",
       "      <td>12.0</td>\n",
       "      <td>70</td>\n",
       "      <td>North America</td>\n",
       "      <td>amc rebel sst</td>\n",
       "      <td>amc</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>17.0</td>\n",
       "      <td>8</td>\n",
       "      <td>302.0</td>\n",
       "      <td>140</td>\n",
       "      <td>3449</td>\n",
       "      <td>10.5</td>\n",
       "      <td>70</td>\n",
       "      <td>North America</td>\n",
       "      <td>ford torino</td>\n",
       "      <td>ford</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>387</th>\n",
       "      <td>27.0</td>\n",
       "      <td>4</td>\n",
       "      <td>140.0</td>\n",
       "      <td>86</td>\n",
       "      <td>2790</td>\n",
       "      <td>15.6</td>\n",
       "      <td>82</td>\n",
       "      <td>North America</td>\n",
       "      <td>ford mustang gl</td>\n",
       "      <td>ford</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>388</th>\n",
       "      <td>44.0</td>\n",
       "      <td>4</td>\n",
       "      <td>97.0</td>\n",
       "      <td>52</td>\n",
       "      <td>2130</td>\n",
       "      <td>24.6</td>\n",
       "      <td>82</td>\n",
       "      <td>Europe</td>\n",
       "      <td>vw pickup</td>\n",
       "      <td>volkswagen</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>389</th>\n",
       "      <td>32.0</td>\n",
       "      <td>4</td>\n",
       "      <td>135.0</td>\n",
       "      <td>84</td>\n",
       "      <td>2295</td>\n",
       "      <td>11.6</td>\n",
       "      <td>82</td>\n",
       "      <td>North America</td>\n",
       "      <td>dodge rampage</td>\n",
       "      <td>dodge</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>390</th>\n",
       "      <td>28.0</td>\n",
       "      <td>4</td>\n",
       "      <td>120.0</td>\n",
       "      <td>79</td>\n",
       "      <td>2625</td>\n",
       "      <td>18.6</td>\n",
       "      <td>82</td>\n",
       "      <td>North America</td>\n",
       "      <td>ford ranger</td>\n",
       "      <td>ford</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>391</th>\n",
       "      <td>31.0</td>\n",
       "      <td>4</td>\n",
       "      <td>119.0</td>\n",
       "      <td>82</td>\n",
       "      <td>2720</td>\n",
       "      <td>19.4</td>\n",
       "      <td>82</td>\n",
       "      <td>North America</td>\n",
       "      <td>chevy s-10</td>\n",
       "      <td>chevrolet</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>392 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      mpg cyl  displ   hp  weight  accel  yr         origin  \\\n",
       "0    18.0   8  307.0  130    3504   12.0  70  North America   \n",
       "1    15.0   8  350.0  165    3693   11.5  70  North America   \n",
       "2    18.0   8  318.0  150    3436   11.0  70  North America   \n",
       "3    16.0   8  304.0  150    3433   12.0  70  North America   \n",
       "4    17.0   8  302.0  140    3449   10.5  70  North America   \n",
       "..    ...  ..    ...  ...     ...    ...  ..            ...   \n",
       "387  27.0   4  140.0   86    2790   15.6  82  North America   \n",
       "388  44.0   4   97.0   52    2130   24.6  82         Europe   \n",
       "389  32.0   4  135.0   84    2295   11.6  82  North America   \n",
       "390  28.0   4  120.0   79    2625   18.6  82  North America   \n",
       "391  31.0   4  119.0   82    2720   19.4  82  North America   \n",
       "\n",
       "                          name         mfr 2022年第一季度  \n",
       "0    chevrolet chevelle malibu   chevrolet        70  \n",
       "1            buick skylark 320       buick        70  \n",
       "2           plymouth satellite    plymouth        70  \n",
       "3                amc rebel sst         amc        70  \n",
       "4                  ford torino        ford        70  \n",
       "..                         ...         ...       ...  \n",
       "387            ford mustang gl        ford        82  \n",
       "388                  vw pickup  volkswagen        82  \n",
       "389              dodge rampage       dodge        82  \n",
       "390                ford ranger        ford        82  \n",
       "391                 chevy s-10   chevrolet        82  \n",
       "\n",
       "[392 rows x 11 columns]"
      ]
     },
     "execution_count": 193,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 数据准备\n",
    "from bokeh.sampledata.autompg import autompg_clean as df\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 204,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"b7fd9b90-a5b7-4085-8a27-eb5a2d4e6bfb\" data-root-id=\"36329\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"5d9f1bbd-2b6a-447a-bef5-4341d98cddf1\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"36340\"}],\"center\":[{\"id\":\"36342\"},{\"id\":\"36346\"}],\"height\":300,\"left\":[{\"id\":\"36343\"}],\"outline_line_color\":null,\"renderers\":[{\"id\":\"36368\"}],\"title\":{\"id\":\"36330\"},\"toolbar\":{\"id\":\"36355\"},\"width\":800,\"x_range\":{\"id\":\"36332\"},\"x_scale\":{\"id\":\"36336\"},\"y_range\":{\"id\":\"36334\"},\"y_scale\":{\"id\":\"36338\"}},\"id\":\"36329\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"MPG\",\"@mpg_mean\"],[\"Cyl, Mfr\",\"@cyl_mfr\"]]},\"id\":\"36354\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"36348\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"37096\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"end\":1,\"factors\":[\"3\",\"4\",\"5\",\"6\",\"8\"],\"palette\":[\"#2b83ba\",\"#abdda4\",\"#ffffbf\",\"#fdae61\",\"#d7191c\"]},\"id\":\"36328\",\"type\":\"CategoricalColorMapper\"},{\"attributes\":{\"start\":0},\"id\":\"36334\",\"type\":\"DataRange1d\"},{\"attributes\":{\"overlay\":{\"id\":\"36353\"}},\"id\":\"36349\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"36351\",\"type\":\"ResetTool\"},{\"attributes\":{\"factors\":[[\"3\",\"mazda\"],[\"4\",\"amc\"],[\"4\",\"audi\"],[\"4\",\"bmw\"],[\"4\",\"buick\"],[\"4\",\"capri\"],[\"4\",\"chevrolet\"],[\"4\",\"chrysler\"],[\"4\",\"datsun\"],[\"4\",\"dodge\"],[\"4\",\"fiat\"],[\"4\",\"ford\"],[\"4\",\"honda\"],[\"4\",\"mazda\"],[\"4\",\"mercedes\"],[\"4\",\"mercury\"],[\"4\",\"nissan\"],[\"4\",\"oldsmobile\"],[\"4\",\"opel\"],[\"4\",\"peugeot\"],[\"4\",\"plymouth\"],[\"4\",\"pontiac\"],[\"4\",\"renault\"],[\"4\",\"saab\"],[\"4\",\"subaru\"],[\"4\",\"toyota\"],[\"4\",\"triumph\"],[\"4\",\"volkswagen\"],[\"4\",\"volvo\"],[\"5\",\"audi\"],[\"5\",\"mercedes\"],[\"6\",\"amc\"],[\"6\",\"buick\"],[\"6\",\"chevrolet\"],[\"6\",\"chrysler\"],[\"6\",\"datsun\"],[\"6\",\"dodge\"],[\"6\",\"ford\"],[\"6\",\"mercedes\"],[\"6\",\"mercury\"],[\"6\",\"oldsmobile\"],[\"6\",\"peugeot\"],[\"6\",\"plymouth\"],[\"6\",\"pontiac\"],[\"6\",\"toyota\"],[\"6\",\"volvo\"],[\"8\",\"amc\"],[\"8\",\"buick\"],[\"8\",\"cadillac\"],[\"8\",\"chevrolet\"],[\"8\",\"chrysler\"],[\"8\",\"dodge\"],[\"8\",\"ford\"],[\"8\",\"hi\"],[\"8\",\"mercury\"],[\"8\",\"oldsmobile\"],[\"8\",\"plymouth\"],[\"8\",\"pontiac\"]],\"range_padding\":0.05},\"id\":\"36332\",\"type\":\"FactorRange\"},{\"attributes\":{\"axis_label\":\"Manufacturer grouped by # Cylinders\",\"coordinates\":null,\"formatter\":{\"id\":\"37096\"},\"group\":null,\"major_label_orientation\":1.2,\"major_label_policy\":{\"id\":\"37097\"},\"ticker\":{\"id\":\"36341\"}},\"id\":\"36340\",\"type\":\"CategoricalAxis\"},{\"attributes\":{},\"id\":\"36344\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"37098\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"36353\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"tools\":[{\"id\":\"36347\"},{\"id\":\"36348\"},{\"id\":\"36349\"},{\"id\":\"36350\"},{\"id\":\"36351\"},{\"id\":\"36352\"},{\"id\":\"36354\"}]},\"id\":\"36355\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"37097\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"37099\",\"type\":\"Selection\"},{\"attributes\":{\"source\":{\"id\":\"36363\"}},\"id\":\"36369\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"36347\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"37094\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"36336\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"axis\":{\"id\":\"36343\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"36346\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"36352\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"37093\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"field\":\"cyl_mfr\",\"transform\":{\"id\":\"36328\"}},\"hatch_alpha\":{\"value\":0.2},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"white\"},\"top\":{\"field\":\"mpg_mean\"},\"x\":{\"field\":\"cyl_mfr\"}},\"id\":\"36367\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"36350\",\"type\":\"SaveTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"field\":\"cyl_mfr\",\"transform\":{\"id\":\"36328\"}},\"hatch_alpha\":{\"value\":0.1},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"white\"},\"top\":{\"field\":\"mpg_mean\"},\"x\":{\"field\":\"cyl_mfr\"}},\"id\":\"36366\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"36341\",\"type\":\"CategoricalTicker\"},{\"attributes\":{},\"id\":\"36338\",\"type\":\"LinearScale\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"36363\"},\"glyph\":{\"id\":\"36365\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"36367\"},\"nonselection_glyph\":{\"id\":\"36366\"},\"view\":{\"id\":\"36369\"}},\"id\":\"36368\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis\":{\"id\":\"36340\"},\"coordinates\":null,\"grid_line_color\":null,\"group\":null,\"ticker\":null},\"id\":\"36342\",\"type\":\"Grid\"},{\"attributes\":{\"data\":{\"accel_25%\":{\"__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JqZmZmZmS9AAAAAAAAAM0AzMzMzMzMzQAAAAAAAAC9AmpmZmZmZM0AAAAAAAAAvQM3MzMzMzC1AZmZmZmZmMUDNzMzMzMwuQAAAAAAAACpAZmZmZmZmLkAAAAAAAAAwQAAAAAAAgDJAzczMzMzMLUAzMzMzMzM2QAAAAAAAAC1AAAAAAAAAKEA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"accel_mean\":{\"__ndarray__\":\"AAAAAACAKkDNzMzMzIwxQFK4HoXrUS5AzczMzMxMKUB4d3d3d3cvQM3MzMzMzC1AMzMzMzNTMkAAAAAAAAAtQML1KFyP4jBAvLu7u7u7LUDNzMzMzEwvQJmZmZmZqTBAwA/8wA/8L0AzMzMzM4MxQM3MzMzMzDVAzczMzMxML0AAAAAAAAAtQJqZmZmZmTFAMzMzMzNzLkBf8RVf8RU0QBWuR+F6FC9A4noUrkdhMEDNzMzMzEwxQJqZmZmZWS5AzczMzMzsMECUD+N+XVIwQDMzMzMzMy5ApwR5SpBnMUCamZmZmRkuQGZmZmZm5jFAmpmZmZkZNEAzMzMzMzMwQEId1EEdVDBA0UUXXXTRL0CamZmZmZkwQHh3d3d3dypAzczMzMzsMUDv7u7u7s4wQDMzMzMzszBAmpmZmZl5MUBmZmZmZuYtQJqZmZmZmS9Ah7VvWPuGMEAzMzMzM3MwQLy7u7u7uytAmpmZmZmZMECamZmZmRkoQB7UQR3UQSlAAAAAAACALUDNzMzMzIwpQJqZmZmZWShAzMzMzMzMKUBSuB6F65EqQAAAAAAAgDJAXY/C9ShcKUCamZmZmRkwQKRwPQrXoyhAvuIrvuIrJkA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"accel_min\":{\"__ndarray__\":\"AAAAAAAAKUAAAAAAAAAuQAAAAAAAACxAAAAAAAAAKUCamZmZmZktQM3MzMzMzC1AAAAAAAAAL0AAAAAAAAAtQAAAAAAAAC1AMzMzMzMzJ0AAAAAAAAAsQDMzMzMzMytAmpmZmZ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/B/zORzj7DUChr7Qkh376PzMzMzMzM+s/bteC/TsB9z8GTyxx9PT5PwAAAAAAAPh//CUK2GSQ+D+e8zdT+FYQQPy1RsY47wJAIrZ6OpM27z8=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"cyl_mfr\":[[\"3\",\"mazda\"],[\"4\",\"amc\"],[\"4\",\"audi\"],[\"4\",\"bmw\"],[\"4\",\"buick\"],[\"4\",\"capri\"],[\"4\",\"chevrolet\"],[\"4\",\"chrysler\"],[\"4\",\"datsun\"],[\"4\",\"dodge\"],[\"4\",\"fiat\"],[\"4\",\"ford\"],[\"4\",\"honda\"],[\"4\",\"mazda\"],[\"4\",\"mercedes\"],[\"4\",\"mercury\"],[\"4\",\"nissan\"],[\"4\",\"oldsmobile\"],[\"4\",\"opel\"],[\"4\",\"peugeot\"],[\"4\",\"plymouth\"],[\"4\",\"pontiac\"],[\"4\",\"renault\"],[\"4\",\"saab\"],[\"4\",\"subaru\"],[\"4\",\"toyota\"],[\"4\",\"triumph\"],[\"4\",\"volkswagen\"],[\"4\",\"volvo\"],[\"5\",\"audi\"],[\"5\",\"mercedes\"],[\"6\",\"amc\"],[\"6\",\"buick\"],[\"6\",\"chevrolet\"],[\"6\",\"chrysler\"],[\"6\",\"datsun\"],[\"6\",\"dodge\"],[\"6\",\"ford\"],[\"6\",\"mercedes\"],[\"6\",\"mercury\"],[\"6\",\"oldsmobile\"],[\"6\",\"peugeot\"],[\"6\",\"plymouth\"],[\"6\",\"pontiac\"],[\"6\",\"toyota\"],[\"6\",\"volvo\"],[\"8\",\"amc\"],[\"8\",\"buick\"],[\"8\",\"cadillac\"],[\"8\",\"chevrolet\"],[\"8\",\"chrysler\"],[\"8\",\"dodge\"],[\"8\",\"ford\"],[\"8\",\"hi\"],[\"8\",\"mercury\"],[\"8\",\"oldsmobile\"],[\"8\",\"plymouth\"],[\"8\",\"pontiac\"]],\"displ_25%\":{\"__ndarray__\":\"AAAAAACAUUAAAAAAABBgQAAAA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VAAAAAAAAAaUAAAAAAADBrQAAAAAAAYGRAAAAAAAAgbEAAAAAAABBuQAAAAAAAgGNAAAAAAABAY0AAAAAAAABzQAAAAAAA4HVAAAAAAADgdUAAAAAAAOB1QAAAAAAAAHlAAAAAAADgc0AAAAAAAPB1QAAAAAAAAHNAAAAAAADwdUAAAAAAAOB1QAAAAAAA4HNAAAAAAAAAeUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"displ_75%\":{\"__ndarray__\":\"AAAAAAAgUkAAAAAAAPBhQAAAAAAAgFxAAAAAAABAXkAAAAAAAOBiQAAAAAAAgGFAAAAAAACAYUAAAAAAAIBjQAAAAAAAsFtAAAAAAADgYEAAAAAAABBZQAAAAAAAgGFAAAAAAADAWkAAAAAAAJBYQAAAAAAAQGJAAAAAAAAAXUAAAAAAAABeQAAAAAAA4GJAAAAAAAAAXUAAAAAAAFBgQAAAAAAAeGBAAAAAAADgYkAAAAAAAKBYQAAAAAAAQF5AAAAAAADwWEAAAAAAACBdQAAAAAAAgF5AAAAAAABAWEAAAAAAANBeQAAAAAAAEGBAAAAAAADgZkAAAAAAACBwQAAAAAAA4GxAAAAAAABAb0AAAAAAACBsQAAAAAAAoGNAAAAAAAAgbEAAAAAAAEBvQAAAAAAAAGVAAAAAAACQakAAAAAAAPhtQAAAAAAAYGRAAAAAAAAgbEAAAAAAAEBvQAAAAAAAQGRAAAAAAADQY0AAAAAAAOBzQAAAAAAAKHlAAAAAAADgdUAAAAAAAOB1QAAAAAAAoHlAAAAAAADgc0AAAAAAAPB1QAAAAAAAAHNAAAAAAADQekAAAAAAAOB1QAAAAAAA6HRAAAAAAAAAeUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"displ_count\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAAAAQAAAAAAAABRAAAAAAAAAAEAAAAAAAAAIQAAAAAAAAPA/AAAAAAAAMEAAAAAAAADwPwAAAAAAADRAAAAAAAAAKEAAAAAAAAAgQ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AAAAAGB4QAAAAAAAcHxAAAAAAADgdUAAAAAAAGB8QAAAAAAAgHtAAAAAAADwd0AAAAAAANB6QAAAAAAAAHNAAAAAAADQekAAAAAAAOB1QAAAAAAAgHtAAAAAAABwfEA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"displ_mean\":{\"__ndarray__\":\"AAAAAAAgUkAAAAAAAABhQM3MzMzMjFpAAAAAAABAXkBVVVVVVTVhQAAAAAAAgGFAAAAAAAA4XkAAAAAAAIBjQAAAAAAA8FdAq6qqqqoyXUAAAAAAAAhXQAAAAAAAmF9A7MRO7MROWEAAAAAAANhXQAAAAAAAQGJAAAAAAACAW0AAAAAAAABeQAAAAAAA4GJAAAAAAADQW0Dbtm3btq1dQAAAAAAAoFxAAAAAAACgYUAAAAAAAABXQAAAAAAAMF1AAAAAAADwWEAhC1nIQlZaQAAAAAAAgF5Ao4suuujCV0AAAAAAANBeQAAAAAAAgF9AAAAAAADgZkB4eHh4eHhtQLdt27Zt+2tAL7rooovubEAAAAAAACBsQKuqqqqqKmNAAAAAAAAgbEAAAAAAAChsQAAAAAAAAGVAAAAAAAAoaUAAAAAAADBrQAAAAAAAYGRAdNFFF100a0AAAAAAABBuQAAAAAAAAGRAAAAAAABAY0AAAAAAABx0QAAAAAAAwHdAAAAAAADgdUAzMzMzMyt1QAAAAAAAAHlAVVVVVVWNdEAzMzMzMyN1QAAAAAAAAHNAmpmZmZmpdkBu27Zt23ZzQJqZmZmZCXVA27Zt27Z9eUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"displ_min\":{\"__ndarray__\":\"AAAAAACAUUAAAAAAAEBeQAAAAAAAQFhAAAAAAABAXkAAAAAAAMBbQAAAAAAAgGFAAAAAAABAVUAAAAAAAIBjQAAAAAAAAFJAAAAAAACAVkAAAAAAAABRQAAAAAAAgFhAAAAAAABAVEAAAAAAAIBTQAAAAAAAQGJAAAAAAACAWEAAAAAAAABeQAAAAAAA4GJAAAAAAABAWEA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bMo/ysg1IQOdiu+j4fENAC1k4Yr3JNEA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"hp_25%\":{\"__ndarray__\":\"AAAAAADQV0AAAAAAAKBUQAAAAAAAwFRAAAAAAACwW0AAAAAAAIBUQAAAAAAAAFdAAAAAAABgUUAAAAAAAABXQAAAAAAAoFBAAAAAAADwU0AAAAAAACBRQAAAAAAAUFNAAAAAAAAATkAAAAAAAEBQQAAAAAAAwFBAAAAAAACAUkAAAAAAAABWQAAAAAAAQFVAAAAAAABQU0AAAAAAAOBSQAAAAAAAYFBAAAAAAABAVUAAAAAAAMBPQAAAAAAAkFpAAAAAAADAUEAAAAAAAOBQQAAAAAAAAFZAAAAAAABASkAAAAAAAEBZQAAAAAAAAFNAAAAAAABAU0AAAAAAAIBWQAAAAAAA4FpAAAAAAAAAWUAAAAAAAEBVQAAAAAAAIFtAAAAAAABgWEAAAAAAAABVQAAAAAAAAF5AAAAAAABwVEAAAAAAACBXQAAAAAAAoGBAAAAAAADAV0AAAAAAAPBZQAAAAAAAAFxAAAAAAAAQVkAAAAAAAMBiQAAAAAAAYGNAAAAAAABYYUAAAAAAADBhQAAAAAAAgGZAAAAAAAD4YUAAAAAAAHhhQAAAAAAAIGhAAAAAAABAYUAAAAAAAOBaQAAAAAAAwGJAAAAAAADgZUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"hp_50%\":{\"__ndarray__\":\"AAAAAACgWEAAAAAAAEBVQAAAAAAAgFZAAAAAAADgW0AAAAAAAABVQAAAAAAAAFdAAAAAAACgU0AAAAAAAABXQAAAAAAAgFFAAAAAAABgVEAAAAAAAMBSQAAAAAAAYFVAAAAAAADAUEAAAAAAAABRQAAAAAAAwFBAAAAAAACAU0AAAAAAAABWQAAAAAAAQFVAAAAAAADgU0AAAAAAAMBVQAAAAAAAgFFAAAAAAAAAVkAAAAAAAEBRQAAAAAAAIFxAAAAAAADAUEAAAAAAAMBSQAAAAAAAAFZAAAAAAACAUUAAAAAAAMBaQAAAAAAAQFVAAAAAAABAU0AAAAAAAABZQAAAAAAAgFtAAAAAAABAWkAAAAAAAEBVQAAAAAAAAF5AAAAAAABAWkAAAAAAAABWQAAAAAAAAF5AAAAAAABAVUAAAAAAAABZQAAAAAAAoGBAAAAAAAAAWUAAAAAAAOBaQAAAAAAAAF1AAAAAAAAgWUAAAAAAAMBiQAAAAAAAoGRAAAAAAAAQY0AAAAAAACBiQAAAAAAAwGdAAAAAAADAYkAAAAAAACBiQAAAAAAAIGhAAAAAAABgYUAAAAAAAIBbQAAAAAAAwGJAAAAAAADgZUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"hp_75%\":{\"__ndarray__\":\"AAAAAACgWUAAAAAAAOBVQAAAAAAAwFZAAAAAAAAQXEAAAAAAAMBVQAAAAAAAAFdAAAAAAAAgVkAAAAAAAABXQAAAAAAAIFdAAAAAAAAAVUAAAAAAAKBTQAAAAAAAAFZAAAAAAAAAUkAAAAAAAGBRQAAAAAAAwFBAAAAAAACAVEAAAAAAAABWQAAAAAAAQFVAAAAAAADQVEAAAAAAAOBVQAAAAAAAAFVAAAAAAACAVkAAAAAAAABTQAAAAAAAwFxAAAAAAABgUkAAAAAAAMBXQAAAAAAAAFZAAAAAAABQUkAAAAAAAABcQAAAAAAAgFdAAAAAAABAU0AAAAAAAABZQAAAAAAAgFtAAAAAAADgWkAAAAAAAEBVQAAAAAAAgF9AAAAAAACAW0AAAAAAAJBWQAAAAAAAAF5AAAAAAACgVkAAAAAAAOBaQAAAAAAAoGBAAAAAAACgWUAAAAAAANBbQAAAAAAAwF1AAAAAAAAwXEAAAAAAAIhjQAAAAAAAAGlAAAAAAADIZEAAAAAAADhjQAAAAAAAiGhAAAAAAABgY0AAAAAAAEhjQAAAAAAAIGhAAAAAAADAaEAAAAAAAEBlQAAAAAAAsGNAAAAAAABQaUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"hp_count\":{\"__ndarray__\":\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AAgGBAAAAAAACAW0AAAAAAAABcQAAAAAAAAF5AAAAAAADAWkAAAAAAAMBcQAAAAAAAoGBAAAAAAABAWkAAAAAAAMBcQAAAAAAAgF5AAAAAAABAX0AAAAAAAMBnQAAAAAAAIGxAAAAAAACAZkAAAAAAAIBrQAAAAAAA4GpAAAAAAABAakAAAAAAAOBqQAAAAAAAIGhAAAAAAAAAakAAAAAAAIBmQAAAAAAA4GpAAAAAAADAbEA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"hp_mean\":{\"__ndarray__\":\"AAAAAADQWEAAAAAAAEBVQJqZmZmZ2VVAAAAAAADgW0CrqqqqqipVQAAAAAAAAFdAAAAAAABYU0AAAAAAAABXQM3MzMzMvFNAq6qqqqraVEAAAAAAAFhSQAAAAAAASFRAYid2Yif2UEAAAAAAALhQQAAAAAAAwFBAAAAAAACAU0AAAAAAAABWQAAAAAAAQFVAAAAAAABAVEBJkiRJkmRUQJqZmZmZOVNAzczMzMyMVUAAAAAAAIBRQAAAAAAAMFtAAAAAAABgUkDTm970pvdTQAAAAAAAAFZA6aKLLroIUEAAAAAAAIBaQAAAAAAAQFVAAAAAAABAU0Di4eHh4eFYQLdt27ZtG11ARhdddNEFWkAAAAAAAEBVQFVVVVVVFV1AAAAAAACgWUBVVVVVVRVWQAAAAAAAAF5AAAAAAADQVUAAAAAAAABZQAAAAAAAoGBARhdddNHFWEAAAAAAAOBaQFVVVVVV1VxAAAAAAAAgWUAAAAAAAExjQCVJkiRJUmZAAAAAAAAQY0AAAAAAAMhiQAAAAAAASGdAq6qqqqp6Y0BmZmZmZu5iQAAAAAAAIGhAMzMzMzNTZEAlSZIkSbJgQAAAAAAA8GNAAAAAAADAZ0A=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"hp_min\":{\"__ndarray__\":\"AAAAAACAVkAAAAAAAABUQAAAAAAAgFNAAAAAAACAW0AAAAAAAABUQAAAAAAAAFdAAAAAAAAASkAAAAAAAABXQAAAAA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e5vFWGBxAyWl5RvlSQUB34pp5zZo0QKdc+kkcYEBAZFcVIAhyQ0DmC02WHw05QOlioZ4Z4zpAMoQKyAEyNUDMHEDTpyA2QAAAAAAAAPh/0QbwVkCbQkA+baHJ9i9DQEApF6jZmzRAtcFsPuTROUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"mpg_25%\":{\"__ndarray__\":\"AAAAAADAMkA0MzMzMxM5QAAAAAAAADdAAAAAAACgNkAAAAAAAIA7QAAAAAAAADlAAAAAAADgOEAAAAAAAAA6QGZmZmZmJjtAzMzMzMxsO0AAAAAAAAA6QDMzMzMz0zZAAAAAAAAAQEBnZmZmZoY/QAAAAAAAAD5AAAAAAABAOkAAAAAAAABCQM3MzMzMzDdAAAAAAADAOEAAAAAAAAA2QM3MzMzMTDpAAAAAAACAOEAAAAAAAIA6QGZmZmZmZjdAAAAAAAAAPUAAAAAAAIA4QAAAAAAAgEFAAAAAAABAOkAAAAAAAMAyQDQzMzMzUzhAZmZmZmZmOUAAAAAAAAAyQJqZmZmZGTNAAAAAAAAAMECamZmZmZkxQJqZmZmZGTdAmpmZmZn5MkAAAAAAAAAyQAAAAAAAgDBAmpmZmZmZMkCamZmZmZk9QDMzMzMzMzBAAAAAAAAAMkAAAAAAAOAyQAAAAAAAgDNAzczMzMxsNEAAAAAAAAAsQAAAAAAAACpAAAAAAAAgMkAAAAAAAAAqQAAAAAAAACpAAAAAAACAK0AAAAAAAAAqQAAAAAAAACJAAAAAAAAAKEAAAAAAAAAoQAAAAAAAACxAAAAAAAAALEA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"mpg_50%\":{\"__ndarray__\":\"AAAAAABANECamZmZmdk5QAAAAAAAADhAAAAAAADAN0BmZmZmZmY8QAAAAAAAADlAAAAAAAAAPEAAAAAAAAA6QAAAAAAAAEBAAAAAAACAPEAAAAAAAIA8QAAAAAAAwDlAAAAAAACAQECamZmZmblAQAAAAAAAAD5AAAAAAACAPUAAAAA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mZmbmQEDNzMzMzIxDQAAAAAAAgEFAZmZmZmYmRkAAAAAAAAA2QDMzMzMzM0JAZmZmZmZmOUAAAAAAAIA2QAAAAAAAADlAzczMzMzMPECamZmZmZkxQJqZmZmZWUBAmpmZmZmZNEAAAAAAAAA4QAAAAAAAgDBAAAAAAAAANUAAAAAAAABDQDMzMzMzMzBAAAAAAAAAN0AAAAAAAIA1QGZmZmZmZjlAMzMzMzOzPkAAAAAAAAAxQGZmZmZm5jBAAAAAAAAAN0AAAAAAAAA0QAAAAAAAgDJAZmZmZmZmM0CamZmZmRkyQAAAAAAAACJAMzMzMzMzNECamZmZmZk6QAAAAAAAADJAAAAAAAAAMEA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"mpg_mean\":{\"__ndarray__\":\"zczMzMyMNECamZmZmdk5QJDC9ShcDzpAAAAAAADAN0BVVVVVVVU8QAAAAAAAADlAmpmZmZlRO0AAAAAAAAA6QPUoXI/C1T9AERERERHRPUCamZmZmek8QDIzMzMzAzpAF3qhF3rhQEAAAAAAAGhBQAAAAAAAAD5AAAAAAACAPUAAAAAAAABCQM3MzMzMzDdAAAAAAADAOUAd1EEd1ME4QHsUrkfhOj9AzczMzMzMO0Crqqqqqqo9QGZmZmZm5jdAZmZmZmaGPkBqq8FzBAo9QAAAAAAAgEFAFl100UXXP0AAAAAAAMAzQJqZmZmZWTxAZmZmZmZmOUAhISEhIaEyQJmZmZmZmTRAnxLkKUEeM0CamZmZmZkxQM3MzMzMTDpANDMzMzOTM0AzMzMzM1MzQAAAAAAAgDBAZmZmZmYmM0AzMzMzMzNAQDMzMzMzMzBAF1100UWXM0DNzMzMzIwzQHh3d3d3dzVAmpmZmZnZN0AAAAAAAOAtQPmKr/iKrytAAAAAAADAM0AK16NwPUouQAAAAAAAAC5ARERERERELkDrUbgehassQAAAAAAAACJA4noUrkfhLUDGV3zFV3wxQAAAAAAAAC1A27Zt27ZtLUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\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PzIJf4/TsgVAkwuaddjbEEAAAAAAAAD4f9z6Q5RHmhZAr6hmWJaq7D8UE9sdnakCQAAAAAAAAPh/a1a8aTiHBkBR7X6Pqq0fQAAAAAAAAPh/gtY0vSoMAUAptL5boFP1Py2Bit39igtAAVjDB+5fI0CVfHAmaUH0P1zHVUIgUvo/lmBHs4BiEkAOM5pJpl8GQNiUMqma6QRAGf4MvyO6A0D19nIPF17/PwAAAAAAAPh/8szklsJ3DUCH39aAveYYQC+gIkHPJfg/TDtjlJsO9D8=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"weight_25%\":{\"__ndarray__\":\"AAAAAADNoUAAAAAAgIKlQAAAAAAAVqFAAAAAAAArokAAAAAAALaiQAAAAAAAGKRAAAAAAIDjoEAAAAAAADKkQAAAAAAAJ59AAAAAAICboEAAAAAAgAGgQAAAAAAAdaJAAAAAAAAgnEAAAAAAAPqeQAAAAAAAZKlAAAAAAIDJoEAAAAAAAOCgQAAAAAAATqZAAAAAAIDKoEAAAAAAAP2lQAAAAACApqBAAAAAAAAepEAAAAAAAFyfQAAAAACAOaRAAAAAAAD0n0AAAAAAADagQAAAAAAAiKNAAAAAAABEnkAAAAAAgMmmQAAAAAAAWKZAAAAAAACUq0AAAAAAAKqmQAAAAAAAE6lAAAAAAAAhqUAAAAAAABKrQAAAAAAAXaZAAAAAAIBfqkAAAAAAgEanQAAAAAAA2K1AAAAAAABZpkAAAAAAgLWlQAAAAAAApKpAAAAAAABPqEAAAAAAgJGpQAAAAAAAS6ZAAAAAAACSqEAAAAAAALCsQAAAAAAAca5AAAAAAABor0AAAAAAgNitQAAAAADAhLBAAAAAAABMrUAAAAAAAD6vQAAAAAAAfLJAAAAAAADmrkAAAAAAAKyrQAAAAACADK9AAAAAAIDrsEA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"weight_50%\":{\"__ndarray__\":\"AAAAAACOokAAAAAAACmmQAAAAAAA/KJAAAAAAADiokAAAAAAAJakQAAAA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AAAAANWrQAAAAAAAxqZAAAAAAACmqEAAAAAAAIuuQAAAAACA+LFAAAAAAACksEAAAAAAAMawQAAAAABAlLFAAAAAAACOsEAAAAAAAEqxQAAAAAAAfLJAAAAAAAAZskAAAAAAAKKwQAAAAABAxbBAAAAAAADWsUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"weight_count\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAAAAQAAAAAAAABRAAAAAAAAAAEAAAAAAAAAIQAAAAAAAAPA/AAAAAAAAMEAAAAAAAADwPwAAAAAAADRAAAAAAAAAKEAAAAAAAAAgQAAAAAAAADBAAAAAAAAAKkAAAAAAAAAgQAAAAAAAAPA/AAAAAAAAAEAAAAAAAADwPwAAAAAAAPA/AAAAAAAAEEAAAAAAAAAcQAAAAAAAACRAAAAAAAAAFEAAAAAAAAAIQAAAAAAAABBAAAAAAAAAEEAAAAAAAAA3QAAAAAAAAPA/AAAAAAAANkAAAAAAAAAQQAAAAAAAAABAAAAAAAAA8D8AAAAAAAAxQAAAAAAAABxAAAAAAAAAJkAAAAAAAADwPwAAAAAAAAhAAAAAAAAAEEAAAAAAAAAoQAAAAAAAAPA/AAAAAAAAEEAAAAAAAAAAQAAAAAAAAPA/AAAAAAAAJkAAAAAAAAAQQAAAAAAAAAhAAAAAAAAAAEAAAAAAAAAgQAAAAAAAABxAAAAAAAAAAEAAAAAAAAA0QAAAAAAAABBAAAAAAAAAKEAAAAAAAAA0QAAAAAAAAPA/AAAAAAAAFEAAAAAAAAAcQAAAAAAAACRAAAAAAAAAHEA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"weight_max\":{\"__ndarray__\":\"AAAAAABApUAAAAAAAHanQAAAAAAADKVAAAAAAABQpEAAAAAAANykQAAAAAAAGKRAAAAAAAAMp0AAAAAAADKkQAAAAAAAbqRAAAAAAADgpUAAAAAAAECjQAAAAAAAlKZAAAAAAAByo0AAAAAAAJakQAAAAAAAZKlAAAAAAABYoU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AfLJAAAAAAAC5sEAlSZIkSViuQGZmZmZmA7BAt23btm2fsUA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"weight_min\":{\"__ndarray__\":\"AAAAAACYoEAAAAAAANykQAAAAAAAGKFAAAAAAAB0oUAAAAAAANagQAAAAAAAGKRAAAAAAADMn0AAAAAAADKkQAAAAAAANJlAAAAAAADsnUAAAAAAACydQAAAAAAAIJxAAAAAAACAm0AAAAAAAMieQAAAAAAAZKlAAAAAAACaoEAAAAAAAOCgQAAAAAAATqZAAAAAAACWoEAAAAAAADSgQAAAAAAATJ1AAAAAAAD4o0AAAAAAAIScQAAAAAAAjqJAAAAAAAAEn0AAAAAAAMSZQAAAAAAAiKNAAAAAAACEnEAAAAAAAGimQAAAAAAAHKZAAAAAAACUq0AAAAAAAJSkQAAAAAAAAqdAAAAAAABGpEAAAAAAABKrQAAAAAAA/qVAAAAAAABAqkAAAAAAADakQAAAAAAA2K1AAAAAAABQo0AAAAAAABilQAAAAAAApKpAAAAAAAAipkAAAAAAAFqpQAAAAAAA7qVAAAAAAACIqEAAAAAAANKqQAAAAAAAHKhAAAAAAAB4rkAAAAAAACqpQAAAAAAAyK5AAAAAAACOqkAAAAAAAMKoQAAAAAAAfLJAAAAAAADkq0AAAAAAAEqqQAAAAAAA2KpAAAAAAAB8sEA=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]},\"weight_std\":{\"__ndarray__\":\"udhs7B3ybkDJgFML7m5tQHQOAgl5pGtAv/NEO9EscECVL0zdOvxxQAAAAAAAAPh/wW0nP4+ucEAAAAAAAAD4f4n/RC1ucG5A26bUH9Bbb0DEkgnxpclmQAu85vvhr3NAil6Fh86ebEAB/frlgRdxQAAAAAAAAPh/Ym4SkDXLUEAAAAAAAAD4fwAAAAAAAPh/hHa7rCxqU0BUF7ym5216QOLeK9lru29Aonh3zZCSVkAlPmxrOcBqQMUzbKCqNmZA0OtrWjrzZUD+ciC3ut5yQAAAAAAAAPh/lJBdHgunZkBfQzaGKodeQBBIF4CUNlVAAAAAAAAA+H8Te53iBNhzQIXSN0vAlXNAusp/48JReEAAAAAAAAD4fzG8WqBzuE5A2ZIlQU44Y0BgQC8tFi9xQAAAAAAAAPh/cuB7YIy9eECVjh7ootdrQAAAAAAAAPh/FPo7/E0Pc0D4jA+ZxktoQK9EMr99CFBAwAofAMZILEBrziyk/kduQPlKCOFf64NAEEgXgJQ2dUCHC8hBP/B5QLvciQn9eXRA2jl5n4Y0e0B/cf0JJxl+QAAAAAAAAPh/adjqBGYEgUBsLGuRdgh9QAyvRS0PL3dAzax/B+OCc0A=\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[58]}},\"selected\":{\"id\":\"37099\"},\"selection_policy\":{\"id\":\"37098\"}},\"id\":\"36363\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_color\":{\"field\":\"cyl_mfr\",\"transform\":{\"id\":\"36328\"}},\"line_color\":{\"value\":\"white\"},\"top\":{\"field\":\"mpg_mean\"},\"x\":{\"field\":\"cyl_mfr\"}},\"id\":\"36365\",\"type\":\"VBar\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"37093\"},\"group\":null,\"major_label_policy\":{\"id\":\"37094\"},\"ticker\":{\"id\":\"36344\"}},\"id\":\"36343\",\"type\":\"LinearAxis\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"Mean MPG by # Cylinders and Manufacturer\"},\"id\":\"36330\",\"type\":\"Title\"}],\"root_ids\":[\"36329\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"5d9f1bbd-2b6a-447a-bef5-4341d98cddf1\",\"root_ids\":[\"36329\"],\"roots\":{\"36329\":\"b7fd9b90-a5b7-4085-8a27-eb5a2d4e6bfb\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "36329"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.sampledata.autompg import autompg_clean as df\n",
    "df.cyl = df.cyl.astype(str)\n",
    "# df.yr = df.yr.astype(str)\n",
    "group = df.groupby(['cyl', 'mfr']) # 复合条件分组，[缸数、厂家]\n",
    "index_cmap = factor_cmap('cyl_mfr', palette=Spectral5, factors=sorted(df.cyl.unique()), end=1)\n",
    "# 画布\n",
    "p = figure(plot_width=800, plot_height=300, title=\"Mean MPG by # Cylinders and Manufacturer\",\n",
    "           x_range=group, tooltips=[(\"MPG\", \"@mpg_mean\"), (\"Cyl, Mfr\", \"@cyl_mfr\")])\n",
    "# 绘图\n",
    "p.vbar(x='cyl_mfr', top='mpg_mean', width=1, source=group,\n",
    "       line_color=\"white\", fill_color=index_cmap, ) # 尾气排放量均值\n",
    "# 其他\n",
    "p.y_range.start = 0\n",
    "p.x_range.range_padding = 0.05  # 同css中的padding\n",
    "p.xgrid.grid_line_color = None\n",
    "p.xaxis.axis_label = \"Manufacturer grouped by # Cylinders\"\n",
    "p.xaxis.major_label_orientation = 1.2 # x轴标签旋转\n",
    "p.outline_line_color = None\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 198,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>指标</th>\n",
       "      <th>2022年第一季度</th>\n",
       "      <th>2021年第四季度</th>\n",
       "      <th>2021年第三季度</th>\n",
       "      <th>2021年第二季度</th>\n",
       "      <th>2021年第一季度</th>\n",
       "      <th>地区</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>13360</td>\n",
       "      <td>44993</td>\n",
       "      <td>35694</td>\n",
       "      <td>23604</td>\n",
       "      <td>12636</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>16230</td>\n",
       "      <td>54854</td>\n",
       "      <td>43592</td>\n",
       "      <td>28897</td>\n",
       "      <td>15472</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>6639</td>\n",
       "      <td>22306</td>\n",
       "      <td>17619</td>\n",
       "      <td>11490</td>\n",
       "      <td>6225</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>20630</td>\n",
       "      <td>75002</td>\n",
       "      <td>56498</td>\n",
       "      <td>38138</td>\n",
       "      <td>19585</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>22274</td>\n",
       "      <td>81518</td>\n",
       "      <td>61243</td>\n",
       "      <td>41381</td>\n",
       "      <td>21189</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>10016</td>\n",
       "      <td>33303</td>\n",
       "      <td>26125</td>\n",
       "      <td>17383</td>\n",
       "      <td>9326</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>22663</td>\n",
       "      <td>78027</td>\n",
       "      <td>58907</td>\n",
       "      <td>40357</td>\n",
       "      <td>21548</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>23772</td>\n",
       "      <td>82429</td>\n",
       "      <td>61915</td>\n",
       "      <td>42348</td>\n",
       "      <td>22636</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>12891</td>\n",
       "      <td>38521</td>\n",
       "      <td>31985</td>\n",
       "      <td>22535</td>\n",
       "      <td>12006</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>19366</td>\n",
       "      <td>57541</td>\n",
       "      <td>44712</td>\n",
       "      <td>30998</td>\n",
       "      <td>18263</td>\n",
       "      <td>浙江省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>22784</td>\n",
       "      <td>68487</td>\n",
       "      <td>52758</td>\n",
       "      <td>36294</td>\n",
       "      <td>21600</td>\n",
       "      <td>浙江省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>12541</td>\n",
       "      <td>35247</td>\n",
       "      <td>28474</td>\n",
       "      <td>20357</td>\n",
       "      <td>11686</td>\n",
       "      <td>浙江省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>16490</td>\n",
       "      <td>47498</td>\n",
       "      <td>36227</td>\n",
       "      <td>25119</td>\n",
       "      <td>15500</td>\n",
       "      <td>江苏省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>19251</td>\n",
       "      <td>57743</td>\n",
       "      <td>44267</td>\n",
       "      <td>30491</td>\n",
       "      <td>18194</td>\n",
       "      <td>江苏省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>10952</td>\n",
       "      <td>26791</td>\n",
       "      <td>20267</td>\n",
       "      <td>14455</td>\n",
       "      <td>10215</td>\n",
       "      <td>江苏省</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   指标  2022年第一季度  2021年第四季度  2021年第三季度  2021年第二季度  2021年第一季度  \\\n",
       "0     居民人均可支配收入累计值(元)      13360      44993      35694      23604      12636   \n",
       "1   城镇居民人均可支配收入累计值(元)      16230      54854      43592      28897      15472   \n",
       "2   农村居民人均可支配收入累计值(元)       6639      22306      17619      11490       6225   \n",
       "3     居民人均可支配收入累计值(元)      20630      75002      56498      38138      19585   \n",
       "4   城镇居民人均可支配收入累计值(元)      22274      81518      61243      41381      21189   \n",
       "5   农村居民人均可支配收入累计值(元)      10016      33303      26125      17383       9326   \n",
       "6     居民人均可支配收入累计值(元)      22663      78027      58907      40357      21548   \n",
       "7   城镇居民人均可支配收入累计值(元)      23772      82429      61915      42348      22636   \n",
       "8   农村居民人均可支配收入累计值(元)      12891      38521      31985      22535      12006   \n",
       "9     居民人均可支配收入累计值(元)      19366      57541      44712      30998      18263   \n",
       "10  城镇居民人均可支配收入累计值(元)      22784      68487      52758      36294      21600   \n",
       "11  农村居民人均可支配收入累计值(元)      12541      35247      28474      20357      11686   \n",
       "12    居民人均可支配收入累计值(元)      16490      47498      36227      25119      15500   \n",
       "13  城镇居民人均可支配收入累计值(元)      19251      57743      44267      30491      18194   \n",
       "14  农村居民人均可支配收入累计值(元)      10952      26791      20267      14455      10215   \n",
       "\n",
       "     地区  \n",
       "0   广东省  \n",
       "1   广东省  \n",
       "2   广东省  \n",
       "3    北京  \n",
       "4    北京  \n",
       "5    北京  \n",
       "6   上海市  \n",
       "7   上海市  \n",
       "8   上海市  \n",
       "9   浙江省  \n",
       "10  浙江省  \n",
       "11  浙江省  \n",
       "12  江苏省  \n",
       "13  江苏省  \n",
       "14  江苏省  "
      ]
     },
     "execution_count": 198,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_居民人均可支配收入 = pd.read_csv('居民人均可支配收入.csv',encoding='utf-8')\n",
    "df_居民人均可支配收入"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 205,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>指标</th>\n",
       "      <th>2022年第一季度</th>\n",
       "      <th>2021年第四季度</th>\n",
       "      <th>2021年第三季度</th>\n",
       "      <th>2021年第二季度</th>\n",
       "      <th>2021年第一季度</th>\n",
       "      <th>地区</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>指标</th>\n",
       "      <th>地区</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">农村居民人均可支配收入累计值(元)</th>\n",
       "      <th>上海市</th>\n",
       "      <th>8</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>12891</td>\n",
       "      <td>38521</td>\n",
       "      <td>31985</td>\n",
       "      <td>22535</td>\n",
       "      <td>12006</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京</th>\n",
       "      <th>5</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>10016</td>\n",
       "      <td>33303</td>\n",
       "      <td>26125</td>\n",
       "      <td>17383</td>\n",
       "      <td>9326</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广东省</th>\n",
       "      <th>2</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>6639</td>\n",
       "      <td>22306</td>\n",
       "      <td>17619</td>\n",
       "      <td>11490</td>\n",
       "      <td>6225</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>江苏省</th>\n",
       "      <th>14</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>10952</td>\n",
       "      <td>26791</td>\n",
       "      <td>20267</td>\n",
       "      <td>14455</td>\n",
       "      <td>10215</td>\n",
       "      <td>江苏省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>浙江省</th>\n",
       "      <th>11</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>12541</td>\n",
       "      <td>35247</td>\n",
       "      <td>28474</td>\n",
       "      <td>20357</td>\n",
       "      <td>11686</td>\n",
       "      <td>浙江省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">城镇居民人均可支配收入累计值(元)</th>\n",
       "      <th>上海市</th>\n",
       "      <th>7</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>23772</td>\n",
       "      <td>82429</td>\n",
       "      <td>61915</td>\n",
       "      <td>42348</td>\n",
       "      <td>22636</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京</th>\n",
       "      <th>4</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>22274</td>\n",
       "      <td>81518</td>\n",
       "      <td>61243</td>\n",
       "      <td>41381</td>\n",
       "      <td>21189</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广东省</th>\n",
       "      <th>1</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>16230</td>\n",
       "      <td>54854</td>\n",
       "      <td>43592</td>\n",
       "      <td>28897</td>\n",
       "      <td>15472</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>江苏省</th>\n",
       "      <th>13</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>19251</td>\n",
       "      <td>57743</td>\n",
       "      <td>44267</td>\n",
       "      <td>30491</td>\n",
       "      <td>18194</td>\n",
       "      <td>江苏省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>浙江省</th>\n",
       "      <th>10</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>22784</td>\n",
       "      <td>68487</td>\n",
       "      <td>52758</td>\n",
       "      <td>36294</td>\n",
       "      <td>21600</td>\n",
       "      <td>浙江省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">居民人均可支配收入累计值(元)</th>\n",
       "      <th>上海市</th>\n",
       "      <th>6</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>22663</td>\n",
       "      <td>78027</td>\n",
       "      <td>58907</td>\n",
       "      <td>40357</td>\n",
       "      <td>21548</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京</th>\n",
       "      <th>3</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>20630</td>\n",
       "      <td>75002</td>\n",
       "      <td>56498</td>\n",
       "      <td>38138</td>\n",
       "      <td>19585</td>\n",
       "      <td>北京</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广东省</th>\n",
       "      <th>0</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>13360</td>\n",
       "      <td>44993</td>\n",
       "      <td>35694</td>\n",
       "      <td>23604</td>\n",
       "      <td>12636</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>江苏省</th>\n",
       "      <th>12</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>16490</td>\n",
       "      <td>47498</td>\n",
       "      <td>36227</td>\n",
       "      <td>25119</td>\n",
       "      <td>15500</td>\n",
       "      <td>江苏省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>浙江省</th>\n",
       "      <th>9</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>19366</td>\n",
       "      <td>57541</td>\n",
       "      <td>44712</td>\n",
       "      <td>30998</td>\n",
       "      <td>18263</td>\n",
       "      <td>浙江省</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                         指标  2022年第一季度  2021年第四季度  2021年第三季度  \\\n",
       "指标                地区                                                           \n",
       "农村居民人均可支配收入累计值(元) 上海市 8   农村居民人均可支配收入累计值(元)      12891      38521      31985   \n",
       "                  北京  5   农村居民人均可支配收入累计值(元)      10016      33303      26125   \n",
       "                  广东省 2   农村居民人均可支配收入累计值(元)       6639      22306      17619   \n",
       "                  江苏省 14  农村居民人均可支配收入累计值(元)      10952      26791      20267   \n",
       "                  浙江省 11  农村居民人均可支配收入累计值(元)      12541      35247      28474   \n",
       "城镇居民人均可支配收入累计值(元) 上海市 7   城镇居民人均可支配收入累计值(元)      23772      82429      61915   \n",
       "                  北京  4   城镇居民人均可支配收入累计值(元)      22274      81518      61243   \n",
       "                  广东省 1   城镇居民人均可支配收入累计值(元)      16230      54854      43592   \n",
       "                  江苏省 13  城镇居民人均可支配收入累计值(元)      19251      57743      44267   \n",
       "                  浙江省 10  城镇居民人均可支配收入累计值(元)      22784      68487      52758   \n",
       "居民人均可支配收入累计值(元)   上海市 6     居民人均可支配收入累计值(元)      22663      78027      58907   \n",
       "                  北京  3     居民人均可支配收入累计值(元)      20630      75002      56498   \n",
       "                  广东省 0     居民人均可支配收入累计值(元)      13360      44993      35694   \n",
       "                  江苏省 12    居民人均可支配收入累计值(元)      16490      47498      36227   \n",
       "                  浙江省 9     居民人均可支配收入累计值(元)      19366      57541      44712   \n",
       "\n",
       "                          2021年第二季度  2021年第一季度   地区  \n",
       "指标                地区                                 \n",
       "农村居民人均可支配收入累计值(元) 上海市 8       22535      12006  上海市  \n",
       "                  北京  5       17383       9326   北京  \n",
       "                  广东省 2       11490       6225  广东省  \n",
       "                  江苏省 14      14455      10215  江苏省  \n",
       "                  浙江省 11      20357      11686  浙江省  \n",
       "城镇居民人均可支配收入累计值(元) 上海市 7       42348      22636  上海市  \n",
       "                  北京  4       41381      21189   北京  \n",
       "                  广东省 1       28897      15472  广东省  \n",
       "                  江苏省 13      30491      18194  江苏省  \n",
       "                  浙江省 10      36294      21600  浙江省  \n",
       "居民人均可支配收入累计值(元)   上海市 6       40357      21548  上海市  \n",
       "                  北京  3       38138      19585   北京  \n",
       "                  广东省 0       23604      12636  广东省  \n",
       "                  江苏省 12      25119      15500  江苏省  \n",
       "                  浙江省 9       30998      18263  浙江省  "
      ]
     },
     "execution_count": 205,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "group = df_居民人均可支配收入.groupby(['指标','地区'])\n",
    "group = df_居民人均可支配收入.groupby(['指标','地区']).apply(lambda x:x[:])\n",
    "\n",
    "group"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 201,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "指标                 地区     \n",
       "农村居民人均可支配收入累计值(元)  上海市  8     12891\n",
       "                   北京   5     10016\n",
       "                   广东省  2      6639\n",
       "                   江苏省  14    10952\n",
       "                   浙江省  11    12541\n",
       "城镇居民人均可支配收入累计值(元)  上海市  7     23772\n",
       "                   北京   4     22274\n",
       "                   广东省  1     16230\n",
       "                   江苏省  13    19251\n",
       "                   浙江省  10    22784\n",
       "居民人均可支配收入累计值(元)    上海市  6     22663\n",
       "                   北京   3     20630\n",
       "                   广东省  0     13360\n",
       "                   江苏省  12    16490\n",
       "                   浙江省  9     19366\n",
       "Name: 2022年第一季度, dtype: int64"
      ]
     },
     "execution_count": 201,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# group['2022年第一季度']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 216,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"51ac70ea-f365-4813-9313-14cd9a6d6929\" data-root-id=\"45057\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"535a74f0-9ea0-4bdb-871e-9d13a1e5fea9\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"45068\"}],\"center\":[{\"id\":\"45070\"},{\"id\":\"45074\"}],\"height\":300,\"left\":[{\"id\":\"45071\"}],\"outline_line_color\":null,\"renderers\":[{\"id\":\"45096\"}],\"title\":{\"id\":\"45058\"},\"toolbar\":{\"id\":\"45083\"},\"width\":800,\"x_range\":{\"id\":\"45060\"},\"x_scale\":{\"id\":\"45064\"},\"y_range\":{\"id\":\"45062\"},\"y_scale\":{\"id\":\"45066\"}},\"id\":\"45057\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"45079\",\"type\":\"ResetTool\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"2022Q1 \\u53ef\\u652f\\u914d\\u6536\\u5165\\u5747\\u503c\"},\"id\":\"45058\",\"type\":\"Title\"},{\"attributes\":{\"tools\":[{\"id\":\"45075\"},{\"id\":\"45076\"},{\"id\":\"45077\"},{\"id\":\"45078\"},{\"id\":\"45079\"},{\"id\":\"45080\"},{\"id\":\"45082\"}]},\"id\":\"45083\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"45078\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"45080\",\"type\":\"HelpTool\"},{\"attributes\":{\"start\":0},\"id\":\"45062\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fill_color\":{\"field\":\"\\u6307\\u6807_\\u5730\\u533a\",\"transform\":{\"id\":\"45056\"}},\"line_color\":{\"value\":\"white\"},\"top\":{\"field\":\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_mean\"},\"x\":{\"field\":\"\\u6307\\u6807_\\u5730\\u533a\"}},\"id\":\"45093\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"45934\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"45930\",\"type\":\"AllLabels\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"45091\"},\"glyph\":{\"id\":\"45093\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"45095\"},\"nonselection_glyph\":{\"id\":\"45094\"},\"view\":{\"id\":\"45097\"}},\"id\":\"45096\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"45933\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"45076\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data\":{\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_25%\":{\"__ndarray__\":\"AAAAAABzx0AAAAAAADfCQAAAAAAAUbhAAAAAAIDzw0AAAAAAANPGQAAAAAAAG9ZAAAAAAECx1EAAAAAAADjOQAAAAACAxNFAAAAAAAAY1UAAAAAAAAvVQAAAAABAINNAAAAAAACuyEAAAAAAAEbOQAAAAADA1dFA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_50%\":{\"__ndarray__\":\"AAAAAABzx0AAAAAAADfCQAAAAAAAUbhAAAAAAIDzw0AAAAAAANPGQAAAAAAAG9ZAAAAAAECx1EAAAAAAADjOQAAAAACAxNFAAAAAAAAY1UAAAAAAAAvVQAAAAABAINNAAAAAAACuyEAAAAAAAEbOQAAAAADA1dFA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_75%\":{\"__ndarray__\":\"AAAAAABzx0AAAAAAADfCQAAAAAAAUbhAAAAAAIDzw0AAAAAAANPGQAAAAAAAG9ZAAAAAAECx1EAAAAAAADjOQAAAAACAxNFAAAAAAAAY1UAAAAAAAAvVQAAAAABAINNAAAAAAACuyEAAAAAAAEbOQAAAAADA1dFA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_count\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_max\":{\"__ndarray__\":\"AAAAAABzx0AAAAAAADfCQAAAAAAAUbhAAAAAAIDzw0AAAAAAANPGQAAAAAAAG9ZAAAAAAECx1EAAAAAAADjOQAAAAACAxNFAAAAAAAAY1UAAAAAAAAvVQAAAAABAINNAAAAAAACuyEAAAAAAAEbOQAAAAADA1dFA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_mean\":{\"__ndarray__\":\"AAAAAABzx0AAAAAAADfCQAAAAAAAUbhAAAAAAIDzw0AAAAAAANPGQAAAAAAAG9ZAAAAAAECx1EAAAAAAADjOQAAAAACAxNFAAAAAAAAY1UAAAAAAAAvVQAAAAABAINNAAAAAAACuyEAAAAAAAEbOQAAAAADA1dFA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_min\":{\"__ndarray__\":\"AAAAAABzx0AAAAAAADfCQAAAAAAAUbhAAAAAAIDzw0AAAAAAANPGQAAAAAAAG9ZAAAAAAECx1EAAAAAAADjOQAAAAACAxNFAAAAAAAAY1UAAAAAAAAvVQAAAAABAINNAAAAAAACuyEAAAAAAAEbOQAAAAADA1dFA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_std\":{\"__ndarray__\":\"AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6_25%\":{\"__ndarray__\":\"AAAAAEA830AAAAAAQIPZQAAAAADANNFAAAAAAMDK00AAAAAAgM7bQAAAAABgO+5AAAAAAGDn7UAAAAAAAEnlQAAAAABgneVAAAAAAMDC6UAAAAAAYMPsQAAAAABAlutAAAAAAMBt4UAAAAAAYLDhQAAAAAAA1eVA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6_50%\":{\"__ndarray__\":\"AAAAAEA830AAAAAAQIPZQAAAAADANNFAAAAAAMDK00AAAAAAgM7bQAAAAABgO+5AAAAAAGDn7UAAAAAAAEnlQAAAAABgneVAAAAAAMDC6UAAAAAAYMPsQAAAAABAlutAAAAAAMBt4UAAAAAAYLDhQAAAAAAA1eVA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6_75%\":{\"__ndarray__\":\"AAAAAEA830AAAAAAQIPZQAAAAADANNFAAAAAAMDK00AAAAAAgM7bQAAAAABgO+5AAAAAAGDn7UAAAAAAAEnlQAAAAABgneVAAAAAAMDC6UAAAAAAYMPsQAAAAABAlutAAAAAAMBt4UAAAAAAYLDhQAAAAAAA1eVA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6_count\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6_max\":{\"__ndarray__\":\"AAAAAEA830AAAAAAQIPZQAAAAADANNFAAAAAAMDK00AAAAAAgM7bQAAAAABgO+5AAAAAAGDn7UAAAAAAAEnlQAAAAABgneVAAAAAAMDC6UAAAAAAYMPsQAAAAABAlutAAAAAAMBt4UAAAAAAYLDhQAAAAAAA1eVA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6_mean\":{\"__ndarray__\":\"AAAAAEA830AAAAAAQIPZQAAAAADANNFAAAAAAMDK00AAAAAAgM7bQAAAAABgO+5AAAAAAGDn7UAAAAAAAEnlQAAAAABgneVAAAAAAMDC6UAAAAAAYMPsQAAAAABAlutAAAAAAMBt4UAAAAAAYLDhQAAAAAAA1eVA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6_min\":{\"__ndarray__\":\"AAAAAEA830AAAAAAQIPZQAAAAADANNFAAAAAAMDK00AAAAAAgM7bQAAAAABgO+5AAAAAAGDn7UAAAAAAAEnlQAAAAABgneVAAAAAAMDC6UAAAAAAYMPsQAAAAABAlutAAAAAAMBt4UAAAAAAYLDhQAAAAAAA1eVA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e09\\u5b63\\u5ea6_std\":{\"__ndarray__\":\"AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6_25%\":{\"__ndarray__\":\"AAAAAMAB1kAAAAAAwPnQQAAAAAAAccZAAAAAAIA7zEAAAAAAQOHTQAAAAACAreRAAAAAAKA05EAAAAAAQDjcQAAAAADAxt1AAAAAAMC44UAAAAAAoLTjQAAAAABAn+JAAAAAAAAN10AAAAAAwIfYQAAAAACARd5A\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6_50%\":{\"__ndarray__\":\"AAAAAMAB1kAAAAAAwPnQQAAAAAAAccZAAAAAAIA7zEAAAAAAQOHTQAAAAACAreRAAAAAAKA05EAAAAAAQDjcQAAAAADAxt1AAAAAAMC44UAAAAAAoLTjQAAAAABAn+JAAAAAAAAN10AAAAAAwIfYQAAAAACARd5A\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6_75%\":{\"__ndarray__\":\"AAAAAMAB1kAAAAAAwPnQQAAAAAAAccZAAAAAAIA7zEAAAAAAQOHTQAAAAACAreRAAAAAAKA05EAAAAAAQDjcQAAAAADAxt1AAAAAAMC44UAAAAAAoLTjQAAAAABAn+JAAAAAAAAN10AAAAAAwIfYQAAAAACARd5A\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6_count\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6_max\":{\"__ndarray__\":\"AAAAAMAB1kAAAAAAwPnQQAAAAAAAccZAAAAAAIA7zEAAAAAAQOHTQAAAAACAreRAAAAAAKA05EAAAAAAQDjcQAAAAADAxt1AAAAAAMC44UAAAAAAoLTjQAAAAABAn+JAAAAAAAAN10AAAAAAwIfYQAAAAACARd5A\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6_mean\":{\"__ndarray__\":\"AAAAAMAB1kAAAAAAwPnQQAAAAAAAccZAAAAAAIA7zEAAAAAAQOHTQAAAAACAreRAAAAAAKA05EAAAAAAQDjcQAAAAADAxt1AAAAAAMC44UAAAAAAoLTjQAAAAABAn+JAAAAAAAAN10AAAAAAwIfYQAAAAACARd5A\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6_min\":{\"__ndarray__\":\"AAAAAMAB1kAAAAAAwPnQQAAAAAAAccZAAAAAAIA7zEAAAAAAQOHTQAAAAACAreRAAAAAAKA05EAAAAAAQDjcQAAAAADAxt1AAAAAAMC44UAAAAAAoLTjQAAAAABAn+JAAAAAAAAN10AAAAAAwIfYQAAAAACARd5A\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u4e8c\\u5b63\\u5ea6_std\":{\"__ndarray__\":\"AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6_25%\":{\"__ndarray__\":\"AAAAACDP4kAAAAAA4ELgQAAAAACAyNVAAAAAAMAp2kAAAAAA4DXhQAAAAADQH/RAAAAAAODm80AAAAAAwMjqQAAAAADgMexAAAAAAHC48EAAAAAAsAzzQAAAAACgT/JAAAAAACD45UAAAAAAQDHnQAAAAACgGOxA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6_50%\":{\"__ndarray__\":\"AAAAACDP4kAAAAAA4ELgQAAAAACAyNVAAAAAAMAp2kAAAAAA4DXhQAAAAADQH/RAAAAAAODm80AAAAAAwMjqQAAAAADgMexAAAAAAHC48EAAAAAAsAzzQAAAAACgT/JAAAAAACD45UAAAAAAQDHnQAAAAACgGOxA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6_75%\":{\"__ndarray__\":\"AAAAACDP4kAAAAAA4ELgQAAAAACAyNVAAAAAAMAp2kAAAAAA4DXhQAAAAADQH/RAAAAAAODm80AAAAAAwMjqQAAAAADgMexAAAAAAHC48EAAAAAAsAzzQAAAAACgT/JAAAAAACD45UAAAAAAQDHnQAAAAACgGOxA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6_count\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6_max\":{\"__ndarray__\":\"AAAAACDP4kAAAAAA4ELgQAAAAACAyNVAAAAAAMAp2kAAAAAA4DXhQAAAAADQH/RAAAAAAODm80AAAAAAwMjqQAAAAADgMexAAAAAAHC48EAAAAAAsAzzQAAAAACgT/JAAAAAACD45UAAAAAAQDHnQAAAAACgGOxA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6_mean\":{\"__ndarray__\":\"AAAAACDP4kAAAAAA4ELgQAAAAACAyNVAAAAAAMAp2kAAAAAA4DXhQAAAAADQH/RAAAAAAODm80AAAAAAwMjqQAAAAADgMexAAAAAAHC48EAAAAAAsAzzQAAAAACgT/JAAAAAACD45UAAAAAAQDHnQAAAAACgGOxA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6_min\":{\"__ndarray__\":\"AAAAACDP4kAAAAAA4ELgQAAAAACAyNVAAAAAAMAp2kAAAAAA4DXhQAAAAADQH/RAAAAAAODm80AAAAAAwMjqQAAAAADgMexAAAAAAHC48EAAAAAAsAzzQAAAAACgT/JAAAAAACD45UAAAAAAQDHnQAAAAACgGOxA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2021\\u5e74\\u7b2c\\u56db\\u5b63\\u5ea6_std\":{\"__ndarray__\":\"AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_25%\":{\"__ndarray__\":\"AAAAAIAtyUAAAAAAAJDDQAAAAAAA77lAAAAAAABkxUAAAAAAgH7IQAAAAAAAN9dAAAAAAIDA1UAAAAAAALPPQAAAAADAzNJAAAAAAABA1kAAAAAAwCHWQAAAAACAJdRAAAAAAAAYykAAAAAAgBrQQAAAAACA6dJA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_50%\":{\"__ndarray__\":\"AAAAAIAtyUAAAAAAAJDDQAAAAAAA77lAAAAAAABkxUAAAAAAgH7IQAAAAAAAN9dAAAAAAIDA1UAAAAAAALPPQAAAAADAzNJAAAAAAABA1kAAAAAAwCHWQAAAAACAJdRAAAAAAAAYykAAAAAAgBrQQAAAAACA6dJA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_75%\":{\"__ndarray__\":\"AAAAAIAtyUAAAAAAAJDDQAAAAAAA77lAAAAAAABkxUAAAAAAgH7IQAAAAAAAN9dAAAAAAIDA1UAAAAAAALPPQAAAAADAzNJAAAAAAABA1kAAAAAAwCHWQAAAAACAJdRAAAAAAAAYykAAAAAAgBrQQAAAAACA6dJA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_count\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_max\":{\"__ndarray__\":\"AAAAAIAtyUAAAAAAAJDDQAAAAAAA77lAAAAAAABkxUAAAAAAgH7IQAAAAAAAN9dAAAAAAIDA1UAAAAAAALPPQAAAAADAzNJAAAAAAABA1kAAAAAAwCHWQAAAAACAJdRAAAAAAAAYykAAAAAAgBrQQAAAAACA6dJA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_mean\":{\"__ndarray__\":\"AAAAAIAtyUAAAAAAAJDDQAAAAAAA77lAAAAAAABkxUAAAAAAgH7IQAAAAAAAN9dAAAAAAIDA1UAAAAAAALPPQAAAAADAzNJAAAAAAABA1kAAAAAAwCHWQAAAAACAJdRAAAAAAAAYykAAAAAAgBrQQAAAAACA6dJA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_min\":{\"__ndarray__\":\"AAAAAIAtyUAAAAAAAJDDQAAAAAAA77lAAAAAAABkxUAAAAAAgH7IQAAAAAAAN9dAAAAAAIDA1UAAAAAAALPPQAAAAADAzNJAAAAAAABA1kAAAAAAwCHWQAAAAACAJdRAAAAAAAAYykAAAAAAgBrQQAAAAACA6dJA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_std\":{\"__ndarray__\":\"AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[15]},\"\\u6307\\u6807_\\u5730\\u533a\":[[\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u4e0a\\u6d77\\u5e02\"],[\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5317\\u4eac\"],[\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5e7f\\u4e1c\\u7701\"],[\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6c5f\\u82cf\\u7701\"],[\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6d59\\u6c5f\\u7701\"],[\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u4e0a\\u6d77\\u5e02\"],[\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5317\\u4eac\"],[\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5e7f\\u4e1c\\u7701\"],[\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6c5f\\u82cf\\u7701\"],[\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6d59\\u6c5f\\u7701\"],[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u4e0a\\u6d77\\u5e02\"],[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5317\\u4eac\"],[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5e7f\\u4e1c\\u7701\"],[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6c5f\\u82cf\\u7701\"],[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6d59\\u6c5f\\u7701\"]]},\"selected\":{\"id\":\"45935\"},\"selection_policy\":{\"id\":\"45934\"}},\"id\":\"45091\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"2022Q1\",\"@2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_mean\"]]},\"id\":\"45082\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"45066\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"45064\",\"type\":\"CategoricalScale\"},{\"attributes\":{},\"id\":\"45932\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"field\":\"\\u6307\\u6807_\\u5730\\u533a\",\"transform\":{\"id\":\"45056\"}},\"hatch_alpha\":{\"value\":0.2},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"white\"},\"top\":{\"field\":\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_mean\"},\"x\":{\"field\":\"\\u6307\\u6807_\\u5730\\u533a\"}},\"id\":\"45095\",\"type\":\"VBar\"},{\"attributes\":{\"source\":{\"id\":\"45091\"}},\"id\":\"45097\",\"type\":\"CDSView\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"45929\"},\"group\":null,\"major_label_policy\":{\"id\":\"45930\"},\"ticker\":{\"id\":\"45072\"}},\"id\":\"45071\",\"type\":\"LinearAxis\"},{\"attributes\":{\"end\":1,\"factors\":[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\"],\"palette\":[\"#99d594\",\"#ffffbf\",\"#fc8d59\"]},\"id\":\"45056\",\"type\":\"CategoricalColorMapper\"},{\"attributes\":{\"overlay\":{\"id\":\"45081\"}},\"id\":\"45077\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"axis_label\":\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6\\u90e8\\u5206\\u57ce\\u5e02\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u5c55\\u793a\",\"coordinates\":null,\"formatter\":{\"id\":\"45932\"},\"group\":null,\"major_label_orientation\":1.2,\"major_label_policy\":{\"id\":\"45933\"},\"ticker\":{\"id\":\"45069\"}},\"id\":\"45068\",\"type\":\"CategoricalAxis\"},{\"attributes\":{},\"id\":\"45075\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"45069\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"field\":\"\\u6307\\u6807_\\u5730\\u533a\",\"transform\":{\"id\":\"45056\"}},\"hatch_alpha\":{\"value\":0.1},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"white\"},\"top\":{\"field\":\"2022\\u5e74\\u7b2c\\u4e00\\u5b63\\u5ea6_mean\"},\"x\":{\"field\":\"\\u6307\\u6807_\\u5730\\u533a\"}},\"id\":\"45094\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"45935\",\"type\":\"Selection\"},{\"attributes\":{\"factors\":[[\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u4e0a\\u6d77\\u5e02\"],[\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5317\\u4eac\"],[\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5e7f\\u4e1c\\u7701\"],[\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6c5f\\u82cf\\u7701\"],[\"\\u519c\\u6751\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6d59\\u6c5f\\u7701\"],[\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u4e0a\\u6d77\\u5e02\"],[\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5317\\u4eac\"],[\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5e7f\\u4e1c\\u7701\"],[\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6c5f\\u82cf\\u7701\"],[\"\\u57ce\\u9547\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6d59\\u6c5f\\u7701\"],[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u4e0a\\u6d77\\u5e02\"],[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5317\\u4eac\"],[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u5e7f\\u4e1c\\u7701\"],[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6c5f\\u82cf\\u7701\"],[\"\\u5c45\\u6c11\\u4eba\\u5747\\u53ef\\u652f\\u914d\\u6536\\u5165\\u7d2f\\u8ba1\\u503c(\\u5143)\",\"\\u6d59\\u6c5f\\u7701\"]],\"range_padding\":0.05},\"id\":\"45060\",\"type\":\"FactorRange\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"45081\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"45929\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis\":{\"id\":\"45071\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"45074\",\"type\":\"Grid\"},{\"attributes\":{\"axis\":{\"id\":\"45068\"},\"coordinates\":null,\"grid_line_color\":null,\"group\":null,\"ticker\":null},\"id\":\"45070\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"45072\",\"type\":\"BasicTicker\"}],\"root_ids\":[\"45057\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"535a74f0-9ea0-4bdb-871e-9d13a1e5fea9\",\"root_ids\":[\"45057\"],\"roots\":{\"45057\":\"51ac70ea-f365-4813-9313-14cd9a6d6929\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "45057"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.palettes import Spectral3\n",
    "df.指标 = df_居民人均可支配收入.指标.astype(str)\n",
    "# df['2022年第一季度'] = df.yr.astype(str)\n",
    "group = df_居民人均可支配收入.groupby(['指标','地区'])\n",
    "index_cmap = factor_cmap('指标_地区', palette=Spectral3, factors=(df.指标.unique()), end=1)\n",
    "\n",
    "# 画布\n",
    "p = figure(\n",
    "    plot_width=800, \n",
    "    plot_height=300, \n",
    "    x_range=group,\n",
    "    title=\"2022Q1 可支配收入均值\",\n",
    "    tooltips=[(\"2022Q1\",\"@2022年第一季度_mean\")]\n",
    ")\n",
    "# 绘图\n",
    "p.vbar(x='指标_地区', top='2022年第一季度_mean', width=1, source=group,\n",
    "       line_color=\"white\", fill_color=index_cmap, ) # 尾气排放量均值\n",
    "# 其他\n",
    "p.y_range.start = 0\n",
    "p.x_range.range_padding = 0.05  # 同css中的padding\n",
    "p.xgrid.grid_line_color = None\n",
    "p.xaxis.axis_label = \"2022年第一季度部分城市人均可支配收入展示\"\n",
    "p.xaxis.major_label_orientation = 1.2 # x轴标签旋转\n",
    "p.outline_line_color = None\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 多维复合序列堆叠柱状图"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Demo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"76272d8c-a1fb-4627-bc71-5fb08f9d6f64\" data-root-id=\"17854\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"1076aa47-365d-497d-9504-fafddc8e2e8a\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"17862\"}],\"center\":[{\"id\":\"17864\"},{\"id\":\"17868\"},{\"id\":\"17904\"}],\"height\":250,\"left\":[{\"id\":\"17865\"}],\"renderers\":[{\"id\":\"17891\"},{\"id\":\"17910\"}],\"title\":{\"id\":\"17893\"},\"toolbar\":{\"id\":\"17876\"},\"x_range\":{\"id\":\"17853\"},\"x_scale\":{\"id\":\"17858\"},\"y_range\":{\"id\":\"17856\"},\"y_scale\":{\"id\":\"17860\"}},\"id\":\"17854\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"17896\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis\":{\"id\":\"17865\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"17868\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"17897\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"17863\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"fields\":[\"east\",\"west\"]},\"id\":\"17886\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"17899\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"fields\":[\"east\"]},\"id\":\"17885\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"17900\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"17869\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"17901\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"label\":{\"value\":\"east\"},\"renderers\":[{\"id\":\"17891\"}]},\"id\":\"17905\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"17870\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"17902\",\"type\":\"Selection\"},{\"attributes\":{\"factors\":[[\"Q1\",\"jan\"],[\"Q1\",\"feb\"],[\"Q1\",\"mar\"],[\"Q2\",\"apr\"],[\"Q2\",\"may\"],[\"Q2\",\"jun\"],[\"Q3\",\"jul\"],[\"Q3\",\"aug\"],[\"Q3\",\"sep\"],[\"Q4\",\"oct\"],[\"Q4\",\"nov\"],[\"Q4\",\"dec\"]],\"range_padding\":0.1},\"id\":\"17853\",\"type\":\"FactorRange\"},{\"attributes\":{\"overlay\":{\"id\":\"17875\"}},\"id\":\"17871\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"data\":{\"east\":[5,5,6,5,5,4,5,6,7,8,6,9],\"west\":[5,7,9,4,5,4,7,7,7,6,6,7],\"x\":[[\"Q1\",\"jan\"],[\"Q1\",\"feb\"],[\"Q1\",\"mar\"],[\"Q2\",\"apr\"],[\"Q2\",\"may\"],[\"Q2\",\"jun\"],[\"Q3\",\"jul\"],[\"Q3\",\"aug\"],[\"Q3\",\"sep\"],[\"Q4\",\"oct\"],[\"Q4\",\"nov\"],[\"Q4\",\"dec\"]]},\"selected\":{\"id\":\"17902\"},\"selection_policy\":{\"id\":\"17901\"}},\"id\":\"17852\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"17905\"},{\"id\":\"17923\"}],\"location\":\"top_center\",\"orientation\":\"horizontal\"},\"id\":\"17904\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"17872\",\"type\":\"SaveTool\"},{\"attributes\":{\"fields\":[\"east\"]},\"id\":\"17884\",\"type\":\"Stack\"},{\"attributes\":{},\"id\":\"17873\",\"type\":\"ResetTool\"},{\"attributes\":{\"label\":{\"value\":\"west\"},\"renderers\":[{\"id\":\"17910\"}]},\"id\":\"17923\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"17874\",\"type\":\"HelpTool\"},{\"attributes\":{\"fields\":[]},\"id\":\"17883\",\"type\":\"Stack\"},{\"attributes\":{\"end\":18,\"start\":0},\"id\":\"17856\",\"type\":\"DataRange1d\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"17885\"}},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"red\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"red\"},\"top\":{\"expr\":{\"id\":\"17886\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x\"}},\"id\":\"17909\",\"type\":\"VBar\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"17852\"},\"glyph\":{\"id\":\"17907\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"17909\"},\"name\":\"west\",\"nonselection_glyph\":{\"id\":\"17908\"},\"view\":{\"id\":\"17911\"}},\"id\":\"17910\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"17858\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"source\":{\"id\":\"17852\"}},\"id\":\"17911\",\"type\":\"CDSView\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"17875\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"17852\"},\"glyph\":{\"id\":\"17888\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"17890\"},\"name\":\"east\",\"nonselection_glyph\":{\"id\":\"17889\"},\"view\":{\"id\":\"17892\"}},\"id\":\"17891\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"17885\"}},\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"red\"},\"hatch_alpha\":{\"value\":0.5},\"hatch_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.5},\"line_color\":{\"value\":\"red\"},\"top\":{\"expr\":{\"id\":\"17886\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x\"}},\"id\":\"17907\",\"type\":\"VBar\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"17883\"}},\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"blue\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"blue\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"blue\"},\"top\":{\"expr\":{\"id\":\"17884\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x\"}},\"id\":\"17890\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"17860\",\"type\":\"LinearScale\"},{\"attributes\":{\"source\":{\"id\":\"17852\"}},\"id\":\"17892\",\"type\":\"CDSView\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"17899\"},\"group\":null,\"major_label_orientation\":1,\"major_label_policy\":{\"id\":\"17900\"},\"ticker\":{\"id\":\"17863\"}},\"id\":\"17862\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"17885\"}},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"red\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"red\"},\"top\":{\"expr\":{\"id\":\"17886\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x\"}},\"id\":\"17908\",\"type\":\"VBar\"},{\"attributes\":{\"coordinates\":null,\"group\":null},\"id\":\"17893\",\"type\":\"Title\"},{\"attributes\":{\"axis\":{\"id\":\"17862\"},\"coordinates\":null,\"grid_line_color\":null,\"group\":null,\"ticker\":null},\"id\":\"17864\",\"type\":\"Grid\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"17883\"}},\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"blue\"},\"hatch_alpha\":{\"value\":0.5},\"hatch_color\":{\"value\":\"blue\"},\"line_alpha\":{\"value\":0.5},\"line_color\":{\"value\":\"blue\"},\"top\":{\"expr\":{\"id\":\"17884\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x\"}},\"id\":\"17888\",\"type\":\"VBar\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"17896\"},\"group\":null,\"major_label_policy\":{\"id\":\"17897\"},\"ticker\":{\"id\":\"17866\"}},\"id\":\"17865\",\"type\":\"LinearAxis\"},{\"attributes\":{\"tools\":[{\"id\":\"17869\"},{\"id\":\"17870\"},{\"id\":\"17871\"},{\"id\":\"17872\"},{\"id\":\"17873\"},{\"id\":\"17874\"}]},\"id\":\"17876\",\"type\":\"Toolbar\"},{\"attributes\":{\"bottom\":{\"expr\":{\"id\":\"17883\"}},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"blue\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"blue\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"blue\"},\"top\":{\"expr\":{\"id\":\"17884\"}},\"width\":{\"value\":0.9},\"x\":{\"field\":\"x\"}},\"id\":\"17889\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"17866\",\"type\":\"BasicTicker\"}],\"root_ids\":[\"17854\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"1076aa47-365d-497d-9504-fafddc8e2e8a\",\"root_ids\":[\"17854\"],\"roots\":{\"17854\":\"76272d8c-a1fb-4627-bc71-5fb08f9d6f64\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "17854"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.core.properties import value\n",
    "from bokeh.models import ColumnDataSource, FactorRange\n",
    "# 数据\n",
    "factors = [\n",
    "    (\"Q1\", \"jan\"), (\"Q1\", \"feb\"), (\"Q1\", \"mar\"),\n",
    "    (\"Q2\", \"apr\"), (\"Q2\", \"may\"), (\"Q2\", \"jun\"),\n",
    "    (\"Q3\", \"jul\"), (\"Q3\", \"aug\"), (\"Q3\", \"sep\"),\n",
    "    (\"Q4\", \"oct\"), (\"Q4\", \"nov\"), (\"Q4\", \"dec\"),\n",
    "\n",
    "]\n",
    "regions = ['east', 'west']\n",
    "source = ColumnDataSource(data=dict(\n",
    "    x=factors,\n",
    "    east=[ 5, 5, 6, 5, 5, 4, 5, 6, 7, 8, 6, 9 ],\n",
    "    west=[ 5, 7, 9, 4, 5, 4, 7, 7, 7, 6, 6, 7 ],\n",
    "))\n",
    "# 画布\n",
    "p = figure(x_range=FactorRange(*factors), plot_height=250,\n",
    "#            toolbar_location=None, tools=\"\"\n",
    "          )\n",
    "# 绘图\n",
    "p.vbar_stack(regions, x='x', width=0.9, alpha=0.5, color=[\"blue\", \"red\"], source=source,\n",
    "             legend=[value(x) for x in regions])\n",
    "# 其他\n",
    "p.y_range.start = 0\n",
    "p.y_range.end = 18\n",
    "p.x_range.range_padding = 0.1\n",
    "p.xaxis.major_label_orientation = 1\n",
    "p.xgrid.grid_line_color = None\n",
    "p.legend.location = \"top_center\"\n",
    "p.legend.orientation = \"horizontal\"\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "育人工作"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "专业知识理论（硬件）\n",
    "\n",
    "素养（软件）\n",
    "\n",
    "学情\n",
    "\n",
    "班会（期中，期末）\n",
    "\n",
    "有想法、有问题的学生（具体，1对1，1对2）\n",
    "\n",
    "关心成长，排忧解难\n",
    "\n",
    "学风\n",
    "\n",
    "计划\n",
    "\n",
    "考研\n",
    "\n",
    "博雅活动\n",
    "\n",
    "班风，院风\n",
    "\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "335.390625px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
